public void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callback, object state)
        {
            var st = new Socks5State();

            st.Callback   = callback;
            st.AsyncState = state;

            ProxyEndPoint = remoteEP;

            _remote.BeginConnect(remoteEP, ConnectCallback, st);
        }
Example #2
0
            private void Connect()
            {
                try
                {
                    var ipAddress = Global.OSSupportsLocalIPv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback;
                    var remoteEp  = new IPEndPoint(ipAddress, _targetPort);

                    _remote = new WrappedSocket();

                    // Connect to the remote endpoint.
                    _remote.BeginConnect(remoteEp, ConnectCallback, null);
                }
                catch (Exception e)
                {
                    Logging.LogUsefulException(e);
                    Close();
                }
            }
Example #3
0
            public void Start(byte[] firstPacket, int length, Socket socket, int targetPort)
            {
                _firstPacket       = firstPacket;
                _firstPacketLength = length;
                _local             = socket;
                try
                {
                    EndPoint remoteEP = SocketUtil.GetEndPoint("127.0.0.1", targetPort);

                    // 连接到远程端点
                    _remote = new WrappedSocket();
                    _remote.BeginConnect(remoteEP, ConnectCallback, null);
                }
                catch (Exception e)
                {
                    Logging.LogUsefulException(e);
                    Close();
                }
            }
Example #4
0
            public void Start(byte[] firstPacket, int length, Socket socket, int targetPort)
            {
                _firstPacket       = firstPacket;
                _firstPacketLength = length;
                _local             = socket;
                try
                {
                    // Local Port Forward use IP as is
                    EndPoint remoteEP = SocketUtil.GetEndPoint(_local.AddressFamily == AddressFamily.InterNetworkV6 ? "[::1]" : "127.0.0.1", targetPort);

                    // Connect to the remote endpoint.
                    _remote = new WrappedSocket();
                    _remote.BeginConnect(remoteEP, ConnectCallback, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }
Example #5
0
        public void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callback, object state)
        {
            ProxyEndPoint = remoteEP;

            _remote.BeginConnect(remoteEP, callback, state);
        }
        public void BeginConnectDest(EndPoint destEndPoint, AsyncCallback callback, object state)
        {
            DestEndPoint = destEndPoint;

            _remote.BeginConnect(destEndPoint, callback, state);
        }
Example #7
0
        public void BeginConnectDest(EndPoint destEndPoint, AsyncCallback callback, object state, NetworkCredential auth = null)
        {
            DestEndPoint = destEndPoint;

            _remote.BeginConnect(destEndPoint, callback, state);
        }