chore(all): make code compilable for other platforms than Linux

This commit is contained in:
Quentin McGaw
2026-01-24 13:48:15 +00:00
parent de38d759a4
commit fe3d4a94d4
35 changed files with 192 additions and 194 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ type Linker interface {
LinkDel(link netlink.Link) (err error)
LinkSetUp(link netlink.Link) (linkIndex int, err error)
LinkSetDown(link netlink.Link) (err error)
LinkSetMTU(link netlink.Link, mtu int) (err error)
LinkSetMTU(link netlink.Link, mtu uint32) (err error)
}
type DNSLoop interface {
+2 -2
View File
@@ -157,7 +157,7 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
// Note: no point testing for an MTU of 1500, it will never work due to the VPN
// protocol overhead, so start lower than 1500 according to the protocol used.
const physicalLinkMTU = 1500
const physicalLinkMTU uint32 = 1500
vpnLinkMTU := physicalLinkMTU
switch vpnType {
case "wireguard":
@@ -183,7 +183,7 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
case err == nil:
logger.Infof("setting VPN interface %s MTU to maximum valid MTU %d", vpnInterface, vpnLinkMTU)
case errors.Is(err, pmtud.ErrMTUNotFound) || errors.Is(err, pmtud.ErrICMPNotPermitted):
vpnLinkMTU = int(originalMTU)
vpnLinkMTU = uint32(originalMTU)
logger.Infof("reverting VPN interface %s MTU to %d (due to: %s)",
vpnInterface, originalMTU, err)
default: