Skip to content

Commit

Permalink
Merge pull request #15 from libp2p/fix/lint
Browse files Browse the repository at this point in the history
fix staticcheck lint issues
  • Loading branch information
Stebalien authored Jul 15, 2021
2 parents 001c870 + 4d1055a commit 68596b5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
16 changes: 0 additions & 16 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions netroute_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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 {
Expand Down
16 changes: 16 additions & 0 deletions netroute_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 68596b5

Please sign in to comment.