Skip to content
Snippets Groups Projects
Commit adf5f02a authored by Wolfgang Welz's avatar Wolfgang Welz
Browse files

Fix check for IPv4/IPv6

parent f18261cd
No related branches found
No related tags found
No related merge requests found
...@@ -91,9 +91,9 @@ func Listen(local *peer.Local, log *zap.SugaredLogger) (*TCP, error) { ...@@ -91,9 +91,9 @@ func Listen(local *peer.Local, log *zap.SugaredLogger) (*TCP, error) {
} }
// if the ip is an external ip, set it to zero // if the ip is an external ip, set it to zero
if tcpAddr.IP.IsGlobalUnicast() { if tcpAddr.IP.IsGlobalUnicast() {
if len(tcpAddr.IP) == net.IPv4len { if tcpAddr.IP.To4() != nil {
tcpAddr.IP = net.IPv4zero tcpAddr.IP = net.IPv4zero
} else if len(tcpAddr.IP) == net.IPv6len { } else {
tcpAddr.IP = net.IPv6zero tcpAddr.IP = net.IPv6zero
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment