chore(deps): upgrade vishvananda/netlink from v1.2.1-beta.2 to v1.2.1

This commit is contained in:
Quentin McGaw
2024-08-23 06:46:29 +00:00
parent 703a546c1d
commit 540acc915d
10 changed files with 24 additions and 22 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ func NewRule() Rule {
// to a `netlink.Rule`
return Rule{
Priority: -1,
Mark: -1,
Mark: 0,
}
}
+3 -3
View File
@@ -36,7 +36,7 @@ type Rule struct {
Priority int
Family int
Table int
Mark int
Mark uint32
Src netip.Prefix
Dst netip.Prefix
Invert bool
@@ -44,12 +44,12 @@ type Rule struct {
func (r Rule) String() string {
from := "all"
if r.Src.IsValid() {
if r.Src.IsValid() && !r.Src.Addr().IsUnspecified() {
from = r.Src.String()
}
to := "all"
if r.Dst.IsValid() {
if r.Dst.IsValid() && !r.Dst.Addr().IsUnspecified() {
to = r.Dst.String()
}
+1 -1
View File
@@ -36,7 +36,7 @@ func (r *Routing) DefaultRoutes() (defaultRoutes []DefaultRoute, err error) {
// ignore non-main table
continue
}
if route.Dst.IsValid() {
if route.Dst.IsValid() && !route.Dst.Addr().IsUnspecified() {
continue
}
defaultRoute := DefaultRoute{
+3 -1
View File
@@ -48,7 +48,9 @@ func (r *Routing) LocalNetworks() (localNetworks []LocalNetwork, err error) {
}
for _, route := range routes {
if route.Table != unix.RT_TABLE_MAIN || route.Gw.IsValid() || !route.Dst.IsValid() {
if route.Table != unix.RT_TABLE_MAIN ||
(route.Gw.IsValid() && !route.Gw.IsUnspecified()) ||
(route.Dst.IsValid() && route.Dst.Addr().IsUnspecified()) {
continue
} else if _, ok := localLinks[route.LinkIndex]; !ok {
continue
+1 -1
View File
@@ -50,7 +50,7 @@ func makeDeviceConfig(settings Settings) (config wgtypes.Config, err error) {
*persistentKeepaliveInterval = settings.PersistentKeepaliveInterval
}
firewallMark := settings.FirewallMark
firewallMark := int(settings.FirewallMark)
config = wgtypes.Config{
PrivateKey: &privateKey,
+3 -3
View File
@@ -9,7 +9,7 @@ import (
)
func (w *Wireguard) addRoutes(link netlink.Link, destinations []netip.Prefix,
firewallMark int) (err error) {
firewallMark uint32) (err error) {
for _, dst := range destinations {
err = w.addRoute(link, dst, firewallMark)
if err == nil {
@@ -29,11 +29,11 @@ func (w *Wireguard) addRoutes(link netlink.Link, destinations []netip.Prefix,
}
func (w *Wireguard) addRoute(link netlink.Link, dst netip.Prefix,
firewallMark int) (err error) {
firewallMark uint32) (err error) {
route := netlink.Route{
LinkIndex: link.Index,
Dst: dst,
Table: firewallMark,
Table: int(firewallMark),
}
err = w.netlink.RouteAdd(route)
+3 -3
View File
@@ -6,13 +6,13 @@ import (
"github.com/qdm12/gluetun/internal/netlink"
)
func (w *Wireguard) addRule(rulePriority, firewallMark, family int) (
cleanup func() error, err error) {
func (w *Wireguard) addRule(rulePriority int, firewallMark uint32,
family int) (cleanup func() error, err error) {
rule := netlink.NewRule()
rule.Invert = true
rule.Priority = rulePriority
rule.Mark = firewallMark
rule.Table = firewallMark
rule.Table = int(firewallMark)
rule.Family = family
if err := w.netlink.RuleAdd(rule); err != nil {
return nil, fmt.Errorf("adding rule %s: %w", rule, err)
+1 -1
View File
@@ -35,7 +35,7 @@ type Settings struct {
PersistentKeepaliveInterval time.Duration
// FirewallMark to be used in routing tables and IP rules.
// It defaults to 51820 if left to 0.
FirewallMark int
FirewallMark uint32
// Maximum Transmission Unit (MTU) setting for the network interface.
// It defaults to device.DefaultMTU from wireguard-go which is 1420
MTU uint16