optimize code

This commit is contained in:
wencaiwulue
2021-10-14 07:25:48 +08:00
parent c3df924e87
commit 5f070710f8

View File

@@ -7,7 +7,6 @@ import (
"fmt"
"github.com/wencaiwulue/kubevpn/util"
"net"
"net/url"
"strconv"
"time"
@@ -619,25 +618,6 @@ func toSocksAddr(addr net.Addr) *gosocks5.Addr {
}
}
type socks5HandshakeOptions struct {
selector gosocks5.Selector
user *url.Userinfo
}
type socks5HandshakeOption func(opts *socks5HandshakeOptions)
func selectorSocks5HandshakeOption(selector gosocks5.Selector) socks5HandshakeOption {
return func(opts *socks5HandshakeOptions) {
opts.selector = selector
}
}
func userSocks5HandshakeOption(user *url.Userinfo) socks5HandshakeOption {
return func(opts *socks5HandshakeOptions) {
opts.user = user
}
}
func socks5Handshake(conn net.Conn) (net.Conn, error) {
cs := &clientSelector{}
cs.AddMethod(