2023-06-15 06:51:19 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
using System.Net;
|
2023-06-19 11:08:42 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2023-06-15 06:51:19 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2023-06-19 11:08:42 +00:00
|
|
|
|
namespace NetTunnelApp;
|
|
|
|
|
|
|
|
|
|
public partial class MainForm : Form
|
2023-06-15 06:51:19 +00:00
|
|
|
|
{
|
2023-07-10 08:36:19 +00:00
|
|
|
|
private List<NetCard> _curNetCard = new List<NetCard>();
|
|
|
|
|
private List<FilePath> _curFilePaths = new List<FilePath>();
|
|
|
|
|
private UserClientCfg _userConfig = new UserClientCfg();
|
|
|
|
|
|
|
|
|
|
private string _wireguardPath = string.Empty;
|
|
|
|
|
|
|
|
|
|
public void GetCurrentNetCard()
|
|
|
|
|
{
|
|
|
|
|
IntPtr pt = new IntPtr(); //Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NetCard)) * 32);
|
|
|
|
|
int size = 0;
|
|
|
|
|
|
|
|
|
|
var v = NetTunnelLib.GetAllNICInfo(out pt, ref size);
|
|
|
|
|
|
|
|
|
|
_curNetCard.Clear();
|
|
|
|
|
|
|
|
|
|
if (v == 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < size; i++)
|
|
|
|
|
{
|
|
|
|
|
IntPtr ptr = new IntPtr(pt.ToInt64() + Marshal.SizeOf(typeof(NetCard)) * i);
|
|
|
|
|
NetCard card = (NetCard)Marshal.PtrToStructure(ptr, typeof(NetCard));
|
|
|
|
|
_curNetCard.Add(card);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Marshal.FreeCoTaskMem(pt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-06-19 11:08:42 +00:00
|
|
|
|
public MainForm()
|
2023-06-15 06:51:19 +00:00
|
|
|
|
{
|
2023-06-19 11:08:42 +00:00
|
|
|
|
InitializeComponent();
|
2023-07-10 08:36:19 +00:00
|
|
|
|
|
2023-06-19 11:08:42 +00:00
|
|
|
|
var path = Environment.CurrentDirectory + "\\tunnelsdk_" +
|
|
|
|
|
string.Format("{0:yyyyMMdd}", DateTime.Now) + ".log";
|
2023-07-25 01:02:16 +00:00
|
|
|
|
//NetTunnelLib.InitTunnelSDKLog(path, LogLevel.LOG_DEBUG);
|
2023-09-01 02:40:08 +00:00
|
|
|
|
NetTunnelLib.TunnelSDKInitEnv(Environment.CurrentDirectory, "http://xajhuang.com:9276", path, LogLevel.LOG_TRACE, menuSetModeServer.Checked);
|
2023-08-15 03:01:31 +00:00
|
|
|
|
//NetTunnelLib.EnableSCGProxy(true, "efc.xajhuang.com", 10001);
|
2023-07-10 08:36:19 +00:00
|
|
|
|
GetCurrentNetCard();
|
2023-06-19 11:08:42 +00:00
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
NetCardMenuItems menuItems = new NetCardMenuItems(_curNetCard);
|
|
|
|
|
NetCardMenuItems ctxMenu = new NetCardMenuItems(_curNetCard);
|
|
|
|
|
|
|
|
|
|
foreach (var item in menuItems.GetMenuItems())
|
|
|
|
|
{
|
|
|
|
|
menuSetModeShareNet.DropDownItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in ctxMenu.GetMenuItems())
|
|
|
|
|
{
|
|
|
|
|
trapMenuSysInterface.DropDownItems.Add(item);
|
|
|
|
|
}
|
2023-06-19 11:08:42 +00:00
|
|
|
|
}
|
2023-06-15 06:51:19 +00:00
|
|
|
|
|
2023-06-20 09:25:14 +00:00
|
|
|
|
private void test_get_network_info()
|
2023-06-19 11:08:42 +00:00
|
|
|
|
{
|
2023-07-10 08:36:19 +00:00
|
|
|
|
IntPtr pt = new IntPtr(); //Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NetCard)) * 32);
|
2023-06-19 11:08:42 +00:00
|
|
|
|
int size = 0;
|
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
var v = NetTunnelLib.GetAllNICInfo(out pt, ref size);
|
2023-06-19 11:08:42 +00:00
|
|
|
|
|
|
|
|
|
Console.WriteLine("Result {0}, total {1}", v, size);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < size; i++)
|
|
|
|
|
{
|
|
|
|
|
IntPtr ptr = new IntPtr(pt.ToInt64() + Marshal.SizeOf(typeof(NetCard)) * i);
|
|
|
|
|
NetCard card = (NetCard)Marshal.PtrToStructure(ptr, typeof(NetCard));
|
|
|
|
|
|
2023-06-21 10:04:16 +00:00
|
|
|
|
Console.WriteLine("UUID:{0}", card.UUID);
|
2023-07-10 08:36:19 +00:00
|
|
|
|
Console.WriteLine("Name:{0}", card.Name);
|
2023-06-19 11:08:42 +00:00
|
|
|
|
Console.WriteLine("Description:{0}", card.Description);
|
2023-06-21 10:04:16 +00:00
|
|
|
|
Console.WriteLine("Index:{0}", card.IfIndex);
|
2023-06-19 11:08:42 +00:00
|
|
|
|
Console.WriteLine("Ip:{0}", card.IpAddr);
|
|
|
|
|
Console.WriteLine("NetMask:{0}", card.NetMask);
|
|
|
|
|
Console.WriteLine("MacAddr:{0}", card.MacAddr);
|
2023-06-15 06:51:19 +00:00
|
|
|
|
}
|
2023-06-19 11:08:42 +00:00
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
Marshal.FreeCoTaskMem(pt);
|
2023-06-15 06:51:19 +00:00
|
|
|
|
}
|
2023-06-20 09:25:14 +00:00
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-06-20 10:23:31 +00:00
|
|
|
|
//var buffer = new StringBuilder(256 + 1);
|
2023-06-20 09:25:14 +00:00
|
|
|
|
//NetTunnelLib.TunnelSDKInitEnv();
|
2023-06-20 10:23:31 +00:00
|
|
|
|
//var v = NetTunnelLib.FindWireguardExe(buffer, 256);
|
|
|
|
|
//MessageBox.Show(buffer.ToString() + "----" + v.ToString());
|
|
|
|
|
|
2023-06-21 10:04:16 +00:00
|
|
|
|
//test_install_wg_server();
|
2023-06-20 09:25:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-06-21 10:04:16 +00:00
|
|
|
|
//test_uninstall_wg_server();
|
|
|
|
|
|
2023-07-17 10:55:01 +00:00
|
|
|
|
test_get_network_info();
|
2023-07-10 08:36:19 +00:00
|
|
|
|
//IntPtr pt = new IntPtr();
|
|
|
|
|
//int size = 0;
|
|
|
|
|
//var v = NetTunnelLib.GetUserConfigure2("admin", out pt, ref size);
|
|
|
|
|
|
|
|
|
|
//for (int i = 0; i < size; i++)
|
|
|
|
|
//{
|
|
|
|
|
// IntPtr ptr = new IntPtr(pt.ToInt64() + Marshal.SizeOf(typeof(FilePath)) * i);
|
|
|
|
|
// FilePath path = (FilePath)Marshal.PtrToStructure(ptr, typeof(FilePath));
|
|
|
|
|
// Console.WriteLine("{0}: {1} status {2}", i, path.CfgPath, path.curUsed);
|
|
|
|
|
// _curFilePaths.Add(path);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//MessageBox.Show(v.ToString());
|
|
|
|
|
|
|
|
|
|
//Marshal.FreeCoTaskMem(pt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuControlRefInterface_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GetCurrentNetCard();
|
|
|
|
|
|
|
|
|
|
NetCardMenuItems menuItems = new NetCardMenuItems(_curNetCard);
|
|
|
|
|
NetCardMenuItems ctxMenu = new NetCardMenuItems(_curNetCard);
|
|
|
|
|
|
2023-07-14 09:29:02 +00:00
|
|
|
|
menuSetModeShareNet.DropDownItems.Clear();
|
|
|
|
|
trapMenuSysInterface.DropDownItems.Clear();
|
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
foreach (var item in menuItems.GetMenuItems())
|
|
|
|
|
{
|
|
|
|
|
menuSetModeShareNet.DropDownItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in ctxMenu.GetMenuItems())
|
|
|
|
|
{
|
|
|
|
|
trapMenuSysInterface.DropDownItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuSetVPNPath_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-07-31 06:07:11 +00:00
|
|
|
|
//DialogResult result = ofDlgWireGuard.ShowDialog();
|
2023-07-10 08:36:19 +00:00
|
|
|
|
|
2023-07-31 06:07:11 +00:00
|
|
|
|
//if (result == DialogResult.OK)
|
|
|
|
|
//{
|
|
|
|
|
// _wireguardPath = ofDlgWireGuard.FileName;
|
|
|
|
|
// NetTunnelLib.SetWireguardPath(_wireguardPath);
|
|
|
|
|
//}
|
|
|
|
|
MessageBox.Show("Not Support");
|
2023-07-10 08:36:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuSetModeClient_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-07-25 01:02:16 +00:00
|
|
|
|
menuSetModeClient.Checked = true;
|
|
|
|
|
menuSetModeServer.Checked = false;
|
2023-07-10 08:36:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuSetModeServer_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-07-25 01:02:16 +00:00
|
|
|
|
menuSetModeServer.Checked = true;
|
|
|
|
|
menuSetModeClient.Checked = false;
|
2023-07-10 08:36:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MainForm_SizeChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.WindowState == FormWindowState.Minimized)
|
|
|
|
|
{
|
|
|
|
|
this.notifyIconMain.Visible = true;
|
|
|
|
|
this.Hide();
|
|
|
|
|
this.ShowInTaskbar = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.notifyIconMain.Visible = false;
|
|
|
|
|
this.ShowInTaskbar = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuFileLogin_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LoginForm f = new LoginForm();
|
|
|
|
|
|
|
|
|
|
f.onLoginServer += (o, args) =>
|
|
|
|
|
{
|
|
|
|
|
IntPtr pt = new IntPtr();
|
|
|
|
|
|
2023-07-14 09:29:02 +00:00
|
|
|
|
if (NetTunnelLib.GetUserClientConfigure(args.HashArgs["UserName"] as string,
|
2023-08-15 03:01:31 +00:00
|
|
|
|
"1689189114026041344",
|
2023-07-10 08:36:19 +00:00
|
|
|
|
out pt) == 0)
|
|
|
|
|
{
|
|
|
|
|
IntPtr p = new IntPtr(pt.ToInt64());
|
|
|
|
|
UserClientConfig cfg = (UserClientConfig)Marshal.PtrToStructure(p, typeof(UserClientConfig));
|
|
|
|
|
|
|
|
|
|
//Console.WriteLine("scgCtrlAppId:{0}", cfg.scgCtrlAppId);
|
|
|
|
|
//Console.WriteLine("scgTunnelAppId:{0}", cfg.scgTunnelAppId);
|
2023-07-14 09:29:02 +00:00
|
|
|
|
//Console.WriteLine("ClientPrivateKey:{0}", cfg.cliPrivateKey);
|
|
|
|
|
//Console.WriteLine("ClientPublicKey:{0}", cfg.cliPublicKey);
|
2023-07-10 08:36:19 +00:00
|
|
|
|
//Console.WriteLine("ClientAddress:{0}", cfg.cliAddress);
|
|
|
|
|
|
|
|
|
|
_userConfig.scgCtrlAppId = cfg.scgCtrlAppId;
|
|
|
|
|
_userConfig.scgTunnelAppId = cfg.scgTunnelAppId;
|
|
|
|
|
_userConfig.cliPrivateKey = cfg.cliPrivateKey;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
_userConfig.cliPublicKey = cfg.cliPublicKey;
|
|
|
|
|
_userConfig.cliAddress = cfg.cliAddress;
|
2023-07-10 08:36:19 +00:00
|
|
|
|
_userConfig.vmList.Clear();
|
2023-07-14 09:29:02 +00:00
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
for (int i = 0; i < cfg.tolVM; i++)
|
|
|
|
|
{
|
|
|
|
|
IntPtr ptr = new IntPtr(cfg.pVMConfig.ToInt64() + Marshal.SizeOf(typeof(VirtualMathineConfig)) * i);
|
|
|
|
|
VirtualMathineConfig vm =
|
|
|
|
|
(VirtualMathineConfig)Marshal.PtrToStructure(ptr, typeof(VirtualMathineConfig));
|
|
|
|
|
|
|
|
|
|
//Console.WriteLine("[{1}]:id: {0}", vm.vmId, i);
|
|
|
|
|
//Console.WriteLine("[{1}]:Name:{0}", vm.vmName, i);
|
|
|
|
|
//Console.WriteLine("[{1}]:ServerPublicKey:{0}", vm.svrPublicKey, i);
|
|
|
|
|
//Console.WriteLine("[{1}]:Network:{0}", vm.vmNetwork, i);
|
|
|
|
|
//Console.WriteLine("[{1}]:EndPoint:{0}", vm.scgGateWay, i);
|
|
|
|
|
_userConfig.vmList.Add(vm);
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-14 09:29:02 +00:00
|
|
|
|
// Don't free any memory
|
|
|
|
|
//Marshal.FreeCoTaskMem(cfg.pVMConfig);
|
|
|
|
|
//Marshal.FreeCoTaskMem(pt);
|
2023-07-10 08:36:19 +00:00
|
|
|
|
|
2023-08-03 09:13:03 +00:00
|
|
|
|
//GetCurrentWgCfgs(args.HashArgs["UserName"] as string);
|
2023-07-10 08:36:19 +00:00
|
|
|
|
|
|
|
|
|
ServerMenuItems svrMenu = new ServerMenuItems(_userConfig.vmList);
|
|
|
|
|
|
2023-07-14 09:29:02 +00:00
|
|
|
|
menuSetModeShareServer.DropDownItems.Clear();
|
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
foreach (var item in svrMenu.GetMenuItems())
|
|
|
|
|
{
|
|
|
|
|
menuSetModeShareServer.DropDownItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//this.DialogResult = DialogResult.Cancel;
|
|
|
|
|
MessageBox.Show("Login Error");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
f.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void trapMenuShowMainWnd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Show();
|
|
|
|
|
this.WindowState = FormWindowState.Normal;
|
|
|
|
|
this.Activate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void trapMenuHideMain_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void trapMenuExit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
System.Environment.Exit(0);
|
2023-06-20 09:25:14 +00:00
|
|
|
|
}
|
2023-07-14 09:29:02 +00:00
|
|
|
|
|
|
|
|
|
private void menuControlSetCliParams_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-07-17 10:55:01 +00:00
|
|
|
|
int ret;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
var v = ServerMenuItems.GetSelectItemData();
|
|
|
|
|
var c = NetCardMenuItems.GetSelectItemData();
|
|
|
|
|
|
|
|
|
|
//Console.WriteLine(v?.scgGateWay);
|
|
|
|
|
//Console.WriteLine(c?.Name);
|
|
|
|
|
|
|
|
|
|
if (v?.scgGateWay.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未选择需要连接的用户虚拟机");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (c?.UUID.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未选择需要共享的本地网络");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-17 10:55:01 +00:00
|
|
|
|
|
2023-07-25 01:02:16 +00:00
|
|
|
|
IPNetwork ipnetwork = IPNetwork.Parse("172.18.2.152", "255.255.255.0");
|
2023-07-17 10:55:01 +00:00
|
|
|
|
//IPNetwork cliNetwork = IPNetwork.Parse(_userConfig.cliAddress);
|
|
|
|
|
|
|
|
|
|
//MessageBox.Show(ipnetwork.Value);
|
|
|
|
|
|
|
|
|
|
//NetTunnelLib.ConnectServerControlService("http://" + v?.scgGateWay);
|
|
|
|
|
|
|
|
|
|
ret = NetTunnelLib.RemoteCtrlSvrCfgUserTunnel(Int32.Parse(v?.vmId.ToString()), ipnetwork.Value);
|
|
|
|
|
|
|
|
|
|
//ret = NetTunnelLib.SetUserClientConfige(_userConfig.cliPublicKey, ipnetwork.Value,
|
|
|
|
|
// cliNetwork.Network.ToString());
|
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
2023-07-14 09:29:02 +00:00
|
|
|
|
{
|
2023-07-17 10:55:01 +00:00
|
|
|
|
MessageBox.Show("SetTunnelConfigure Error: " + ret.ToString());
|
|
|
|
|
return;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
}
|
2023-07-17 10:55:01 +00:00
|
|
|
|
|
|
|
|
|
//ret = NetTunnelLib.SetTunnelConfigure(_userConfig.cliPrivateKey, v?.svrPublicKey, v?.vmNetwork,
|
|
|
|
|
// _userConfig.cliAddress, v?.scgGateWay);
|
|
|
|
|
|
|
|
|
|
//if (ret != 0)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("SetTunnelConfigure Error: " + ret.ToString());
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
2023-07-14 09:29:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuControlSvrStart_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var ret = NetTunnelLib.RemoteWireGuardControl(true);
|
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
2023-07-17 10:55:01 +00:00
|
|
|
|
MessageBox.Show("RemoteWireGuardControl Error: " + ret.ToString());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = NetTunnelLib.LocalWireGuardControl(true, true);
|
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("LocalWireGuardControl Error: " + ret.ToString());
|
|
|
|
|
return;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuControlSvrStop_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-08-15 03:01:31 +00:00
|
|
|
|
var ret = NetTunnelLib.LocalWireGuardControl(false);
|
2023-07-14 09:29:02 +00:00
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
2023-08-15 03:01:31 +00:00
|
|
|
|
MessageBox.Show("LocalWireGuardControl Error: " + ret.ToString());
|
2023-07-17 10:55:01 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 03:01:31 +00:00
|
|
|
|
ret = NetTunnelLib.RemoteWireGuardControl(false);
|
|
|
|
|
|
2023-07-17 10:55:01 +00:00
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
2023-08-15 03:01:31 +00:00
|
|
|
|
MessageBox.Show("RemoteWireGuardControl Error: " + ret.ToString());
|
2023-07-17 10:55:01 +00:00
|
|
|
|
return;
|
2023-07-14 09:29:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuControlHeartStart_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-07-17 10:55:01 +00:00
|
|
|
|
HeartCallBack cb = new HeartCallBack((string msg, uint tm) => { Console.WriteLine(msg + tm.ToString()); });
|
2023-07-14 09:29:02 +00:00
|
|
|
|
|
|
|
|
|
var ret = NetTunnelLib.RemoteHeartControl(true, cb);
|
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error: " + ret.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuControlHeartStop_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var ret = NetTunnelLib.RemoteHeartControl(false, null);
|
|
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error: " + ret.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-25 01:02:16 +00:00
|
|
|
|
|
|
|
|
|
private void menuSetShareModeICS_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
menuSetShareModeNAT.Checked = false;
|
|
|
|
|
menuSetShareModeICS.Checked = true;
|
|
|
|
|
NetTunnelLib.SetCurrentNetShareMode(NET_SHARE_MODE.ICS_SHARE_MODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void menuSetShareModeNAT_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
menuSetShareModeICS.Checked = false;
|
|
|
|
|
menuSetShareModeNAT.Checked = true;
|
|
|
|
|
NetTunnelLib.SetCurrentNetShareMode(NET_SHARE_MODE.NAT_SHARE_MODE);
|
|
|
|
|
}
|
2023-06-19 11:08:42 +00:00
|
|
|
|
}
|