示例#1
0
 private static void Network()
 {
     RunningConfiguration.Network.NetworkInterfaces = cmds.Network.Get();
     cmds.Network.SetTuns();
     cmds.Network.SetTaps();
     Brctl.Apply();
     Bond.Apply();
     RunningConfiguration.Network.NetworkInterfaces = cmds.Network.Get();
     cmds.Network.Prepare();
     WiFi.Apply();
     cmds.Network.Set();
     cmds.Network.ApplyNetwork(CurrentConfiguration.Network.InternalNetwork);
     cmds.Network.ApplyNetwork(CurrentConfiguration.Network.ExternalNetwork);
     Route.SetRoutingTable();
     Route.Set();
     ConsoleLogger.Log("[network] ready");
 }
示例#2
0
        public BondModule() : base("/bond")
        {
            Get["/"] = x => {
                return(JsonConvert.SerializeObject(Application.CurrentConfiguration.Network.Bonds));
            };

            Get["/running"] = x => {
                return(JsonConvert.SerializeObject(Application.RunningConfiguration.Network.Bonds));
            };

            Post["/save"] = x => {
                string data    = Request.Form.Data;
                var    objects = JsonConvert.DeserializeObject <NetBond[]>(data);
                Application.CurrentConfiguration.Network.Bonds = objects;
                ConfigRepo.Save();
                return(HttpStatusCode.OK);
            };

            Post["/apply"] = x => {
                Bond.Apply();
                return(HttpStatusCode.OK);
            };
        }