diff --git a/proxy/http/http.go b/proxy/http/http.go index 06e31ff..3bc3fa3 100644 --- a/proxy/http/http.go +++ b/proxy/http/http.go @@ -212,7 +212,12 @@ func (s *HTTP) servHTTPS(method, requestURI, proto string, c net.Conn) { } // Addr returns forwarder's address -func (s *HTTP) Addr() string { return s.addr } +func (s *HTTP) Addr() string { + if s.addr == "" { + return s.dialer.Addr() + } + return s.addr +} // NextDialer returns the next dialer func (s *HTTP) NextDialer(dstAddr string) proxy.Dialer { return s.dialer.NextDialer(dstAddr) } diff --git a/proxy/socks5/socks5.go b/proxy/socks5/socks5.go index 1f97793..0dcbc4a 100644 --- a/proxy/socks5/socks5.go +++ b/proxy/socks5/socks5.go @@ -213,7 +213,12 @@ func (s *SOCKS5) ListenAndServeUDP() { } // Addr returns forwarder's address -func (s *SOCKS5) Addr() string { return s.addr } +func (s *SOCKS5) Addr() string { + if s.addr == "" { + return s.dialer.Addr() + } + return s.addr +} // NextDialer returns the next dialer func (s *SOCKS5) NextDialer(dstAddr string) proxy.Dialer { return s.dialer.NextDialer(dstAddr) } diff --git a/proxy/ss/ss.go b/proxy/ss/ss.go index 145baec..39cd62e 100644 --- a/proxy/ss/ss.go +++ b/proxy/ss/ss.go @@ -231,7 +231,12 @@ func ListCipher() string { } // Addr returns forwarder's address -func (s *SS) Addr() string { return s.addr } +func (s *SS) Addr() string { + if s.addr == "" { + return s.dialer.Addr() + } + return s.addr +} // NextDialer returns the next dialer func (s *SS) NextDialer(dstAddr string) proxy.Dialer { return s.dialer.NextDialer(dstAddr) } diff --git a/proxy/vmess/client.go b/proxy/vmess/client.go index 8089ebf..e96cab1 100644 --- a/proxy/vmess/client.go +++ b/proxy/vmess/client.go @@ -24,9 +24,9 @@ const ( // SEC types const ( - SecTypeUnknown byte = 0 - SecTypeLegacy byte = 1 - SecTypeAuto byte = 2 + SecTypeUnknown byte = 0 // don't use in client + SecTypeLegacy byte = 1 // don't use in client (aes-128-cfb) + SecTypeAuto byte = 2 // don't use in client SecTypeAES128GCM byte = 3 SecTypeChacha20Poly1305 byte = 4 SecTypeNone byte = 5 diff --git a/proxy/vmess/user.go b/proxy/vmess/user.go index e40db4d..ca2d6a3 100644 --- a/proxy/vmess/user.go +++ b/proxy/vmess/user.go @@ -8,8 +8,6 @@ import ( "errors" "strings" "time" - - "github.com/nadoo/glider/common/log" ) // User of vmess client @@ -32,7 +30,6 @@ func nextID(oldID [16]byte) (newID [16]byte) { for { md5hash.Sum(newID[:0]) if !bytes.Equal(oldID[:], newID[:]) { - log.F("oldID: %x, newID: %x", oldID, newID) return } md5hash.Write([]byte("533eff8a-4113-4b10-b5ce-0f5d76b98cd2")) diff --git a/proxy/vmess/vmess.go b/proxy/vmess/vmess.go index a3ff203..c0d7881 100644 --- a/proxy/vmess/vmess.go +++ b/proxy/vmess/vmess.go @@ -82,7 +82,12 @@ func NewVMessDialer(s string, dialer proxy.Dialer) (proxy.Dialer, error) { } // Addr returns forwarder's address -func (s *VMess) Addr() string { return s.addr } +func (s *VMess) Addr() string { + if s.addr == "" { + return s.dialer.Addr() + } + return s.addr +} // NextDialer returns the next dialer func (s *VMess) NextDialer(dstAddr string) proxy.Dialer { return s.dialer.NextDialer(dstAddr) }