more
This commit is contained in:
parent
1d24781c86
commit
7c6dca6e40
6
main.go
6
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)
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue