Esempio n. 1
0
        public static async void RelayHandler(IAsyncReadWrite from, IAsyncReadWrite to)
        {
            to.DataWritten += async(o, c) => await Transfer(to, from, c);

            from.DataWritten += async(o, c) => await Transfer(from, to, c);
            await Transfer(from, to, from.Unread);
        }
Esempio n. 2
0
        private static async Task Transfer(IAsyncReadWrite read, IAsyncReadWrite write, int c)
        {
            if (c == 0)
            {
                return;
            }
            if (c < 0)
            {
                write.FinishWrite();
            }
            else
            {
                var data = await read.Read(c);

                await write.Write(data);
            }
        }
Esempio n. 3
0
 public HttpHandler(IAsyncReadWrite buf)
 {
     this.buf = buf;
 }
Esempio n. 4
0
 public Socks5Handler(IAsyncReadWrite readWrite)
 {
     this.readWrite = readWrite;
 }