Fix relay IPv4 address resolution behind DNS64

This commit is contained in:
DasSkelett 2022-05-16 22:04:55 +02:00
parent 9de06a6bf9
commit 38ed8ecc3c
No known key found for this signature in database
GPG Key ID: CD4711E34050A172
2 changed files with 6 additions and 5 deletions

View File

@ -778,7 +778,7 @@ func (c *Client) Receive() (err error) {
continue
}
serverTry := fmt.Sprintf("%s:%s", ip, port)
serverTry := net.JoinHostPort(ip, port)
conn, banner2, externalIP, errConn := tcp.ConnectToTCPServer(serverTry, c.Options.RelayPassword, c.Options.SharedSecret[:3], 500*time.Millisecond)
if errConn != nil {
log.Debug(errConn)

View File

@ -79,15 +79,16 @@ func init() {
}
}
var err error
DEFAULT_RELAY, err = lookup(DEFAULT_RELAY)
var addr string
addr, err = lookup(DEFAULT_RELAY)
if err == nil {
DEFAULT_RELAY += ":" + DEFAULT_PORT
DEFAULT_RELAY = net.JoinHostPort(addr, DEFAULT_PORT)
} else {
DEFAULT_RELAY = ""
}
DEFAULT_RELAY6, err = lookup(DEFAULT_RELAY6)
addr, err = lookup(DEFAULT_RELAY6)
if err == nil {
DEFAULT_RELAY6 = "[" + DEFAULT_RELAY6 + "]:" + DEFAULT_PORT
DEFAULT_RELAY6 = net.JoinHostPort(addr, DEFAULT_PORT)
} else {
DEFAULT_RELAY6 = ""
}