diff options
author | Oleg Kovalov <iamolegkovalov@gmail.com> | 2018-07-30 17:30:09 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-30 17:30:09 +0800 |
commit | d42ce0f2c1b52e26cce475e411d97165fb975577 (patch) | |
tree | 03043c37becf49145b23f4824f563e3443335698 /p2p/nat/natupnp.go | |
parent | 273c7a9dc4e8961e96e51bd8274436ff983a21ef (diff) | |
download | dexon-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.go | 7 |
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 } } } |