From 7c6dca6e401058954c1eb13bdc8761e0e7a3a2b4 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 29 Aug 2018 08:12:07 -0400 Subject: [PATCH] more --- main.go | 6 +++--- vendor/socks5/request.go | 6 +++++- vendor/socks5/socks5.go | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index c300a25..70e20d7 100644 --- a/main.go +++ b/main.go @@ -24,15 +24,15 @@ func main() { return } serv, err := socks5.New(&socks5.Config{ - Dial: func(_ context.Context, network, addr string) (net.Conn, error) { + Dial: func(addr string) (net.Conn, error) { host, _, err := net.SplitHostPort(addr) if err != nil { return nil, err } if strings.HasSuffix(host, ".onion") { - return upstream.Dial(network, addr) + return upstream.Dial("tcp", addr) } - return net.Dial(network, addr) + return net.Dial("tcp", addr) }, }) diff --git a/vendor/socks5/request.go b/vendor/socks5/request.go index 5f46687..67167d5 100644 --- a/vendor/socks5/request.go +++ b/vendor/socks5/request.go @@ -71,10 +71,14 @@ type Request struct { // AddrSpec of the the network that sent the request RemoteAddr *AddrSpec // AddrSpec of the desired destination - DestAddr *AddrSpec + DestAddr AddrSpec bufConn io.Reader } +func (req *Request) ConnectAddress() string { + return req.DestAddr.Address() +} + type conn interface { io.WriteCloser RemoteAddr() net.Addr diff --git a/vendor/socks5/socks5.go b/vendor/socks5/socks5.go index 4651ce1..641b892 100644 --- a/vendor/socks5/socks5.go +++ b/vendor/socks5/socks5.go @@ -38,7 +38,7 @@ type Config struct { Logger *log.Logger // Optional function for dialing out - Dial func(ctx context.Context, network, addr string) (net.Conn, error) + Dial func(addr string) (net.Conn, error) } // Server is reponsible for accepting connections and handling