Skip to content

fix staticcheck lint issues #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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