コード例 #1
0
        public DebugVpnContext()
        {
#if !YT_MOCK
            tun              = new TunInterface();
            tun.PacketPoped += Tun_PacketPoped;
#endif
        }
コード例 #2
0
ファイル: HttpAdapter.cs プロジェクト: oooOtis/YtFlowTunnel
        public HttpAdapter(string srv, int port, TcpSocket socket, TunInterface tun) : base(socket, tun)
        {
            server    = srv;
            this.port = port;

            Init();
        }
コード例 #3
0
        internal TunSocketAdapter(TcpSocket socket, TunInterface tun)
        {
            var pipe = new Pipe();

            pipeReader = pipe.Reader;
            pipeWriter = pipe.Writer;
            _socket    = socket;
            _tun       = tun;

            socket.DataReceived += Socket_DataReceived;
            socket.DataSent     += Socket_DataSent;
            socket.SocketError  += Socket_SocketError;

            StartPolling();
        }
コード例 #4
0
ファイル: ProxyAdapter.cs プロジェクト: oooOtis/YtFlowTunnel
 public ProxyAdapter(TcpSocket socket, TunInterface tun) : base(socket, tun)
 {
     ReadData   += ProxyAdapter_ReadData;
     OnError    += ProxyAdapter_OnError;
     OnFinished += ProxyAdapter_OnFinished;
 }
コード例 #5
0
        public ShadowsocksAdapter(string srv, int port, ICryptor _cryptor, TcpSocket socket, TunInterface tun) : base(socket, tun)
        {
            server    = srv;
            this.port = port;
            cryptor   = _cryptor;

            Init();
        }
コード例 #6
0
ファイル: TrojanAdapter.cs プロジェクト: oooOtis/YtFlowTunnel
        public TrojanAdapter(string srv, int port, string hashedPassword, TcpSocket socket, TunInterface tun) : base(socket, tun)
        {
            if (!ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                throw new InvalidOperationException("Trojan adapter is not supported on platforms earlier than 1709");
            }
            server    = srv;
            this.port = port;
            // TODO: hash password
            if (hashedPassword.Length != 56 || hashedPassword.Any(c => !((c >= 0 && c <= 9) || (c > 'a' && c < 'f'))))
            {
                throw new ArgumentOutOfRangeException("Hashed password only allows 56 hex characters");
            }

            Init(hashedPassword);
        }
コード例 #7
0
 public DebugVpnContext(string port)
 {
     tun              = new TunInterface();
     tun.PacketPoped += Tun_PacketPoped;
     this.port        = port;
 }