general: use dialer's address if there's no self address

This commit is contained in:
nadoo committed 2018-07-04 11:05:43 +08:00
1 parent f6fae13d88
commit e320dc5508
6 files changed
+27 -10

No files matched your search

+3 -3
View File
@@ -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
-3
View File
@@ -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"))
+6 -1
View File
@@ -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) }