From 8a2ebe32dce700367f6df4a4dc405715980f9186 Mon Sep 17 00:00:00 2001 From: ap4y Date: Mon, 11 Jan 2016 20:21:34 +1300 Subject: [PATCH] Introduce Request struct Encapsulates state of the incoming request --- request.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/request.go b/request.go index 0b4a83e..f1f9bb1 100644 --- a/request.go +++ b/request.go @@ -47,6 +47,23 @@ type AddrSpec struct { Port int } +// A Request represents request received by a server +type Request struct { + // Protocol version + Version uint8 + // Requested command + Command uint8 + // AuthContext provided during negotiation + AuthContext *AuthContext + // AddrSpec of the the network that sent the request + RemoteAddr *AddrSpec + // AddrSpec of the desired destination + DestAddr *AddrSpec + // AddrSpec of the actual destination (might be affected by rewrite) + realDestAddr *AddrSpec + bufConn io.Reader +} + type conn interface { Write([]byte) (int, error) RemoteAddr() net.Addr