Merge pull request #15 from libp2p/fix/lint

fix staticcheck lint issues
This commit is contained in:
Steven Allen
2021-07-15 15:42:40 -07:00
committed by GitHub
3 changed files with 19 additions and 19 deletions
-16
View File
@@ -18,22 +18,6 @@ import (
"strings"
)
// Pulled from http://man7.org/linux/man-pages/man7/rtnetlink.7.html
// See the section on RTM_NEWROUTE, specifically 'struct rtmsg'.
type routeInfoInMemory struct {
Family byte
DstLen byte
SrcLen byte
TOS byte
Table byte
Protocol byte
Scope byte
Type byte
Flags uint32
}
// rtInfo contains information on a single route.
type rtInfo struct {
Src, Dst *net.IPNet
+3 -3
View File
@@ -69,10 +69,10 @@ func New() (routing.Router, error) {
routeInfo := new(rtInfo)
if m.Version < 3 || m.Version > 5 {
return nil, fmt.Errorf("Unexpected RIB message version: %d", m.Version)
return nil, fmt.Errorf("unexpected RIB message version: %d", m.Version)
}
if m.Type != 4 /* RTM_GET */ {
return nil, fmt.Errorf("Unexpected RIB message type: %d", m.Type)
return nil, fmt.Errorf("unexpected RIB message type: %d", m.Type)
}
if m.Flags&RTF_UP == 0 ||
@@ -95,7 +95,7 @@ func New() (routing.Router, error) {
}
routeInfo.Dst = ipn
} else {
return nil, fmt.Errorf("Unexpected RIB destination: %v", err)
return nil, fmt.Errorf("unexpected RIB destination: %v", err)
}
if m.Flags&RTF_GATEWAY != 0 {
+16
View File
@@ -20,6 +20,22 @@ import (
"github.com/google/gopacket/routing"
)
// Pulled from http://man7.org/linux/man-pages/man7/rtnetlink.7.html
// See the section on RTM_NEWROUTE, specifically 'struct rtmsg'.
type routeInfoInMemory struct {
Family byte
DstLen byte
SrcLen byte
TOS byte
Table byte
Protocol byte
Scope byte
Type byte
Flags uint32
}
func New() (routing.Router, error) {
rtr := &router{}
rtr.ifaces = make(map[int]net.Interface)