mirror of
https://github.com/netbirdio/go-netroute.git
synced 2026-05-22 17:11:07 -07:00
Merge pull request #15 from libp2p/fix/lint
fix staticcheck lint issues
This commit is contained in:
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user