@@ -18,6 +18,8 @@ import (
1818 "strings"
1919)
2020
21+ //lint:file-ignore U1000 structs here used by different build tags
22+
2123// rtInfo contains information on a single route.
2224type rtInfo struct {
2325 Src , Dst * net.IPNet
@@ -60,23 +62,10 @@ func (rt rtInfo) IsMoreSpecThan(mostSpecificRt *rtInfo) bool {
6062 return mostSpecificRt .Priority >= rt .Priority
6163}
6264
63- // routeSlice implements sort.Interface to sort routes by Priority.
64- type routeSlice []* rtInfo
65-
66- func (r routeSlice ) Len () int {
67- return len (r )
68- }
69- func (r routeSlice ) Less (i , j int ) bool {
70- return r [i ].Priority < r [j ].Priority
71- }
72- func (r routeSlice ) Swap (i , j int ) {
73- r [i ], r [j ] = r [j ], r [i ]
74- }
75-
7665type router struct {
7766 ifaces map [int ]net.Interface
7867 addrs map [int ]ipAddrs
79- v4 , v6 routeSlice
68+ v4 , v6 [] * rtInfo
8069}
8170
8271func (r * router ) String () string {
@@ -132,7 +121,7 @@ func (r *router) RouteWithSrc(input net.HardwareAddr, src, dst net.IP) (iface *n
132121 return
133122}
134123
135- func (r * router ) route (routes routeSlice , input net.HardwareAddr , src , dst net.IP ) (iface int , gateway , preferredSrc net.IP , err error ) {
124+ func (r * router ) route (routes [] * rtInfo , input net.HardwareAddr , src , dst net.IP ) (iface int , gateway , preferredSrc net.IP , err error ) {
136125 var inputIndex uint32
137126 if input != nil {
138127 for i , iface := range r .ifaces {
0 commit comments