aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat/natupnp.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/nat/natupnp.go')
-rw-r--r--p2p/nat/natupnp.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go
index 69099ac04..029143b7b 100644
--- a/p2p/nat/natupnp.go
+++ b/p2p/nat/natupnp.go
@@ -81,11 +81,8 @@ func (n *upnp) internalAddress() (net.IP, error) {
return nil, err
}
for _, addr := range addrs {
- switch x := addr.(type) {
- case *net.IPNet:
- if x.Contains(devaddr.IP) {
- return x.IP, nil
- }
+ if x, ok := addr.(*net.IPNet); ok && x.Contains(devaddr.IP) {
+ return x.IP, nil
}
}
}