aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat/natupnp.go
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2018-07-30 17:30:09 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-30 17:30:09 +0800
commitd42ce0f2c1b52e26cce475e411d97165fb975577 (patch)
tree03043c37becf49145b23f4824f563e3443335698 /p2p/nat/natupnp.go
parent273c7a9dc4e8961e96e51bd8274436ff983a21ef (diff)
downloaddexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.gz
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.bz2
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.lz
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.xz
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.tar.zst
dexon-d42ce0f2c1b52e26cce475e411d97165fb975577.zip
all: simplify switches (#17267)
* all: simplify switches * silly mistake
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
}
}
}