all: simplify switches (#17267)
* all: simplify switches * silly mistake
This commit is contained in:
committed by
Péter Szilágyi
parent
273c7a9dc4
commit
d42ce0f2c1
@ -115,8 +115,7 @@ func potentialGateways() (gws []net.IP) {
|
||||
return gws
|
||||
}
|
||||
for _, addr := range ifaddrs {
|
||||
switch x := addr.(type) {
|
||||
case *net.IPNet:
|
||||
if x, ok := addr.(*net.IPNet); ok {
|
||||
if lan10.Contains(x.IP) || lan176.Contains(x.IP) || lan192.Contains(x.IP) {
|
||||
ip := x.IP.Mask(x.Mask).To4()
|
||||
if ip != nil {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,7 @@ func (sn *SimNode) NodeInfo() *p2p.NodeInfo {
|
||||
}
|
||||
|
||||
func setSocketBuffer(conn net.Conn, socketReadBuffer int, socketWriteBuffer int) error {
|
||||
switch v := conn.(type) {
|
||||
case *net.UnixConn:
|
||||
if v, ok := conn.(*net.UnixConn); ok {
|
||||
err := v.SetReadBuffer(socketReadBuffer)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user