Ejemplo n.º 1
0
 public TransparentSocksConnection(Socket client, DebugWriter debug, ConnectionTracker connectionTracker, ConfigureProxySocket configureProxySocket)
 {
     this.client               = client;
     this.debug                = debug;
     this.connectionTracker    = connectionTracker;
     this.configureProxySocket = configureProxySocket;
 }
Ejemplo n.º 2
0
 public LogConnection(TcpClient client, DebugWriter debug, ConnectionTracker connectionTracker, Natter natter)
 {
     this.client            = client;
     this.debug             = debug;
     this.connectionTracker = connectionTracker;
     this.natter            = natter;
     stream = client.GetStream();
 }
Ejemplo n.º 3
0
        public void Start()
        {
            connectionTracker = (ConnectionTracker)services["connectionTracker"];

            Port = ((IPEndPoint)transparentSocksServer.Client.LocalEndPoint).Port;
            debug.Log(0, "TransparentUdpPort = " + Port);
            connection = new TransparentUdpConnection(transparentSocksServer, debug, connectionTracker, ConfigureSocksProxy);
            connection.Process();
        }
Ejemplo n.º 4
0
        public void Start()
        {
            connectionTracker = (ConnectionTracker)services["connectionTracker"];
            natter            = (Natter)services["natter"];

            logServer.Start();
            debug.Log(0, "LogPort = " + ((IPEndPoint)logServer.LocalEndpoint).Port);
            logServer.BeginAcceptTcpClient(NewLogConnection, null);
        }
Ejemplo n.º 5
0
        public void Start()
        {
            connectionTracker = (ConnectionTracker)services["connectionTracker"];

            transparentSocksServer.Start();
            Port = ((IPEndPoint)transparentSocksServer.LocalEndpoint).Port;
            debug.Log(0, "TransparentSocksPort = " + Port);
            transparentSocksServer.BeginAcceptSocket(NewTransparentSocksConnection, null);
        }
Ejemplo n.º 6
0
        public void Start()
        {
            connectionTracker = (ConnectionTracker)services["connectionTracker"];

            transparentSocksServer.Start();
            Port    = ((IPEndPoint)transparentSocksServer.LocalEndpoint).Port;
            Address = IPAddress.Parse(Settings.Default.IPAddress);

            debug.Log(0, $"TransparentSocks = {Address}:{Port}");
            transparentSocksServer.BeginAcceptSocket(NewTransparentSocksConnection, null);
        }
Ejemplo n.º 7
0
        public TransparentUdpConnection(UdpClient server, DebugWriter debug, ConnectionTracker connectionTracker, ConfigureProxySocket configureProxySocket)
        {
            proxies = new ConcurrentDictionary <IPEndPoint, CountedProxySocket>();

            this.server               = server;
            this.debug                = debug;
            this.connectionTracker    = connectionTracker;
            this.configureProxySocket = configureProxySocket;


            localEndPoint = (IPEndPoint)server.Client.LocalEndPoint;
            if (localEndPoint.Address.Equals(IPAddress.Any))
            {
                localEndPoint = new IPEndPoint(IPAddress.Parse(Settings.Default.IPAddress), localEndPoint.Port);
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }