chore(netlink): define own types with minimal fields
- Allow to swap `github.com/vishvananda/netlink` - Allow to add build tags for each platform - One step closer to development on non-Linux platforms
This commit is contained in:
@@ -2,17 +2,17 @@ package wireguard
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/netlink"
|
||||
)
|
||||
|
||||
// TODO add IPv6 route if IPv6 is supported
|
||||
|
||||
func (w *Wireguard) addRoute(link netlink.Link, dst *net.IPNet,
|
||||
func (w *Wireguard) addRoute(link netlink.Link, dst netip.Prefix,
|
||||
firewallMark int) (err error) {
|
||||
route := &netlink.Route{
|
||||
LinkIndex: link.Attrs().Index,
|
||||
route := netlink.Route{
|
||||
LinkIndex: link.Index,
|
||||
Dst: dst,
|
||||
Table: firewallMark,
|
||||
}
|
||||
@@ -21,7 +21,7 @@ func (w *Wireguard) addRoute(link netlink.Link, dst *net.IPNet,
|
||||
if err != nil {
|
||||
return fmt.Errorf(
|
||||
"adding route for link %s, destination %s and table %d: %w",
|
||||
link.Attrs().Name, dst, firewallMark, err)
|
||||
link.Name, dst, firewallMark, err)
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user