public static void _returnEth() { BridgeList._lcl_bridge("p"); Data._lcl_bridge = Data._tmp; string patern = "[(ID=]+\\d+[)|]+[Operating]+g"; string repl = ""; Regex rgx = new System.Text.RegularExpressions.Regex(patern); string input = Data._lcl_bridge; string result1; string result2 = rgx.Replace(input, repl).Trim(); if (result2.Contains("|Operating")) { string result1a = result2.Replace("|Operating", "").Replace(" ", " ").Trim(); result1 = result1a; } else { result1 = result2; } var ip = "127.0.0.1"; ushort port = 5555; var pw = "pirkon12"; using (var softEther = new SoftEther(ip, port)) { var connectResult = softEther.Connect(); if (!connectResult.Valid()) { return; } var authResult = softEther.Authenticate(pw); if (!authResult.Valid()) { return; } var EthDev = softEther.ServerApi.GetEthernetDeviceList(); for (int i = 0; i < EthDev.Elements.Count; i++) { if (EthDev.Elements[i].DeviceName.Contains(result1)) { Data._bridgeWindowsname = EthDev.Elements[i].NetworkConnectionName; } } return; } }
public static void Test() { var IP = "vpn203410648.softether.net"; var pw = "12345"; ushort port = 443; var hubName = "Tools"; var userName = "******"; var network = "192.168.178.0"; var networkSubnet = "255.255.255.0"; { using (var softEther = new SoftEther(IP, port)) { var connectResult = softEther.Connect(); if (!connectResult.Valid()) { string _V = "error"; return; } var authResult = softEther.Authenticate(pw); if (!authResult.Valid()) { string _V = "error"; return; } var natOnline = softEther.HubApi.EnableSecureNat(hubName); var natOptions = softEther.HubApi.GetSecureNatOptions(hubName); var pushRoutesResult = softEther.HubApi.SetSecureNatDhcpPushRoutes(hubName, new DhcpRouteCollection { { network, networkSubnet, natOptions.DhcpGatewayAddress.ToString() } }); var deviceAclList = softEther.HubApi.SetAccessList(hubName, AccessListFactory.AllowDevicesOnly( natOptions.DhcpGatewayAddress, natOptions.DhcpSubnetMask, new AccessDevice("192.168.178.240", "Server"))); var fritz = softEther.HubApi.AddAccessList(hubName, AccessListFactory.AccessToDevice(AccessListFactory.AllowDevicesPriority, "FritzBox", IPAddress.Parse("192.168.178.1"), natOptions.DhcpGatewayAddress, natOptions.DhcpSubnetMask)); } } }
public static void getUsers() { var ip = "139.162.142.110"; ushort port = 8789; var pw = "Pirkon1612-/"; var hubName = "ManRem"; var userName = "******"; using (var softEther = new SoftEther(ip, port)) { var connectResult = softEther.Connect(); if (!connectResult.Valid()) { return; } var authResult = softEther.Authenticate(pw); if (!authResult.Valid()) { return; } var user = softEther.HubApi.GetUser(hubName, userName); var hbUL = softEther.HubApi.GetUserList(hubName); int i; int c = hbUL.Count; for (i = 0; i <= c - 1; i++) { string v = (i + 1).ToString(); string v1 = hbUL[i].Name.ToString() + ":" + hbUL[i].LastLoginTime.ToString(); List <string> res = v1.Split(new char[] { ':' }).ToList(); } // List<string> result = names.Split(',').ToList(); //var user = softEther.HubApi.GetUser(hubName, userName); // hbUL[i].Name } }
public SoftEtherHub(SoftEther softEther) { _softEther = softEther; }
public SoftEtherServer(SoftEther softEther) { _softEther = softEther; }