Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.Write("run as server(y/n) ? ");

            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                tserver.Http();
                //Console.Write("\nEnter ssl certificate password: "******"ssl.pfx");
                //var certificate = new X509Certificate2(certificateFile, password, X509KeyStorageFlags.DefaultKeySet);
                //var server = new SslPipelineServer(certificate, IPAddress.Any, 8811, 50);
                //var http = new Http.HttpPipelineServer(server);
                //var tunnelServer = new TunnelPipelineServer(http);
                //tunnelServer.Run<object>(Connect);
            }
            else
            {
                var client       = new SslClientPipeline(IPAddress.Loopback, 8811);
                var tunnelClient = new TunnelPipeline(client);
                client.Connect(OnConnect, tunnelClient);
            }

            Console.WriteLine("\npress ESC to exit.");
            while (Console.ReadKey(true).Key != ConsoleKey.Escape)
            {
                ;
            }
        }
Esempio n. 2
0
        static void OnConnect(IPipeline pipeline, bool success, TunnelPipeline tunnelPipeline)
        {
            if (success == false)
            {
                return;
            }

            var packet = new BufferPacket(pipeline, new byte[] { 1, 2, 3 });

            packet.SetBufferSize(3);
            tunnelPipeline.Output(packet, CompleteOutput, default(object));
        }
Esempio n. 3
0
        public const int VersionValue = 2;      // 010

        public TunnelPacket(TunnelPipeline pipeline) : base(pipeline)
        {
        }