chore(all): replace net.IP with netip.Addr

This commit is contained in:
Quentin McGaw
2023-05-20 19:58:18 +00:00
parent 00ee6ff9a7
commit 0a29337c3b
91 changed files with 525 additions and 590 deletions

View File

@@ -2,14 +2,13 @@ package routing
import (
"fmt"
"net"
"net/netip"
"strconv"
"github.com/qdm12/gluetun/internal/netlink"
)
func (r *Routing) addRouteVia(destination netip.Prefix, gateway net.IP,
func (r *Routing) addRouteVia(destination netip.Prefix, gateway netip.Addr,
iface string, table int) error {
destinationStr := destination.String()
r.logger.Info("adding route for " + destinationStr)
@@ -25,7 +24,7 @@ func (r *Routing) addRouteVia(destination netip.Prefix, gateway net.IP,
route := netlink.Route{
Dst: NetipPrefixToIPNet(&destination),
Gw: gateway,
Gw: gateway.AsSlice(),
LinkIndex: link.Attrs().Index,
Table: table,
}
@@ -37,7 +36,7 @@ func (r *Routing) addRouteVia(destination netip.Prefix, gateway net.IP,
return nil
}
func (r *Routing) deleteRouteVia(destination netip.Prefix, gateway net.IP,
func (r *Routing) deleteRouteVia(destination netip.Prefix, gateway netip.Addr,
iface string, table int) (err error) {
destinationStr := destination.String()
r.logger.Info("deleting route for " + destinationStr)
@@ -53,7 +52,7 @@ func (r *Routing) deleteRouteVia(destination netip.Prefix, gateway net.IP,
route := netlink.Route{
Dst: NetipPrefixToIPNet(&destination),
Gw: gateway,
Gw: gateway.AsSlice(),
LinkIndex: link.Attrs().Index,
Table: table,
}