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