lib/connections: Fix WANAddresses returning only unspecified IPs (ref #9010) (#9073)

Avoids taking the address of the same variable twice.
This commit is contained in:
Maximilian 2023-09-03 17:03:27 +02:00 committed by GitHub
parent 5118538179
commit c42c0e7ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,10 +178,10 @@ func (t *tcpListener) WANAddresses() []*url.URL {
// For every address with a specified IP, add one without an IP,
// just in case the specified IP is still internal (router behind DMZ).
if len(addr.IP) != 0 && !addr.IP.IsUnspecified() {
uri = *t.uri
zeroUri := *t.uri
addr.IP = nil
uri.Host = addr.String()
uris = append(uris, &uri)
zeroUri.Host = addr.String()
uris = append(uris, &zeroUri)
}
}
}