protected override void OnStart(string[] args) { services["connectionTracker"] = new ConnectionTracker(debug, services); services["natter"] = new Natter(debug, services); services["logServer"] = new LogServer(debug, services); services["transparentSocksServer"] = new TransparentSocksServer(debug, services); services["connectionTracker"].Start(); services["natter"].Start(); services["logServer"].Start(); services["transparentSocksServer"].Start(); }
public void Start() { tunTapDevice.SetMediaStatus(true); connectionTracker = (ConnectionTracker)services["connectionTracker"]; transparentSocksServer = (TransparentSocksServer)services["transparentSocksServer"]; debug.Log(0, "Name = " + tunTapDevice.Name); debug.Log(0, "Guid = " + tunTapDevice.Guid.ToString("B")); debug.Log(0, "Mac = " + tunTapDevice.GetMac()); debug.Log(0, "Version = " + tunTapDevice.GetVersion()); debug.Log(0, "Mtu = " + tunTapDevice.GetMtu()); var localIP = IPAddress.Parse(Settings.Default.IPAddress); var remoteNetwork = IPAddress.Parse(Settings.Default.RemoteNetwork); var remoteNetmask = IPAddress.Parse(Settings.Default.RemoteNetmask); tunTapDevice.ConfigTun(localIP, remoteNetwork, remoteNetmask); NetworkHelper.SetStaticIPAddress( tunTapDevice.Guid.ToString("B"), localIP.ToString(), Settings.Default.SubnetMask, Settings.Default.DNSServer ); var localAddrBytes = localIP.GetAddressBytes(); localAddrBytes[localAddrBytes.Length - 1] = (byte)((localAddrBytes[localAddrBytes.Length - 1] << 1) % byte.MaxValue); virtualAddress = new IPAddress(localAddrBytes); try { NetworkHelper.SetupTapGateway(tunTapDevice.Guid); } catch (Exception ex) { debug.Log(0, ex.ToString()); } BeginRun(NatterStopped, null); }
public void Start() { connectionTracker = (ConnectionTracker)services["connectionTracker"]; transparentSocksServer = (TransparentSocksServer)services["transparentSocksServer"]; debug.Log(0, "Name = " + tunTapDevice.Name); debug.Log(0, "Guid = " + tunTapDevice.Guid.ToString("B")); debug.Log(0, "Mac = " + tunTapDevice.GetMac()); debug.Log(0, "Version = " + tunTapDevice.GetVersion()); debug.Log(0, "Mtu = " + tunTapDevice.GetMtu()); var localIP = IPAddress.Parse(Settings.Default.IPAddress); var remoteNetwork = IPAddress.Parse(Settings.Default.RemoteNetwork); var remoteNetmask = IPAddress.Parse(Settings.Default.RemoteNetmask); tunTapDevice.ConfigTun(localIP, remoteNetwork, remoteNetmask); var adapterNetmask = IPAddress.Parse(Settings.Default.DHCPNetmask); var dhcpServerAddr = IPAddress.Parse(Settings.Default.DHCPServer); var dhcpLeaseTime = Settings.Default.DHCPLeaseTime; tunTapDevice.ConfigDhcpMasq(localIP, adapterNetmask, dhcpServerAddr, dhcpLeaseTime); tunTapDevice.ConfigDhcpSetOptions( new DhcpOption.Routers( dhcpServerAddr ), new DhcpOption.VendorOptions( new DhcpVendorOption.NetBIOSOverTCP(2) ) ); tunTapDevice.SetMediaStatus(true); BeginRun(NatterStopped, null); }