From 8f323b740d7171120b6619b320a77973b2ea7d6b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 24 Nov 2019 21:09:29 +0000 Subject: [PATCH] Revert "TUN_OFFSET_BYTES per platform" This reverts commit 85c5bc61ac39169f96b9c853d63e165823a014e1. --- src/tuntap/iface.go | 2 ++ src/tuntap/tun_bsd.go | 2 -- src/tuntap/tun_darwin.go | 2 -- src/tuntap/tun_linux.go | 2 -- src/tuntap/tun_other.go | 2 -- src/tuntap/tun_windows.go | 4 +--- 6 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/tuntap/iface.go b/src/tuntap/iface.go index 633903da..f1ca0add 100644 --- a/src/tuntap/iface.go +++ b/src/tuntap/iface.go @@ -9,6 +9,8 @@ import ( "github.com/Arceliar/phony" ) +const TUN_OFFSET_BYTES = 4 + type tunWriter struct { phony.Inbox tun *TunAdapter diff --git a/src/tuntap/tun_bsd.go b/src/tuntap/tun_bsd.go index 79184cb9..219e3485 100644 --- a/src/tuntap/tun_bsd.go +++ b/src/tuntap/tun_bsd.go @@ -15,8 +15,6 @@ import ( wgtun "golang.zx2c4.com/wireguard/tun" ) -const TUN_OFFSET_BYTES = 0 - const SIOCSIFADDR_IN6 = (0x80000000) | ((288 & 0x1fff) << 16) | uint32(byte('i'))<<8 | 12 type in6_addrlifetime struct { diff --git a/src/tuntap/tun_darwin.go b/src/tuntap/tun_darwin.go index 4dab6f31..cf2fbfb4 100644 --- a/src/tuntap/tun_darwin.go +++ b/src/tuntap/tun_darwin.go @@ -15,8 +15,6 @@ import ( wgtun "golang.zx2c4.com/wireguard/tun" ) -const TUN_OFFSET_BYTES = 0 - // Configures the "utun" adapter with the correct IPv6 address and MTU. func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error { if ifname == "auto" { diff --git a/src/tuntap/tun_linux.go b/src/tuntap/tun_linux.go index ca402522..4206b26a 100644 --- a/src/tuntap/tun_linux.go +++ b/src/tuntap/tun_linux.go @@ -9,8 +9,6 @@ import ( wgtun "golang.zx2c4.com/wireguard/tun" ) -const TUN_OFFSET_BYTES = 0 - // Configures the TUN adapter with the correct IPv6 address and MTU. func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error { if ifname == "auto" { diff --git a/src/tuntap/tun_other.go b/src/tuntap/tun_other.go index 85934f39..8a27f57b 100644 --- a/src/tuntap/tun_other.go +++ b/src/tuntap/tun_other.go @@ -9,8 +9,6 @@ import ( wgtun "golang.zx2c4.com/wireguard/tun" ) -const TUN_OFFSET_BYTES = 0 - // Configures the TUN adapter with the correct IPv6 address and MTU. func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error { iface, err := wgtun.CreateTUN(ifname, mtu) diff --git a/src/tuntap/tun_windows.go b/src/tuntap/tun_windows.go index e611af76..9b5f7b0c 100644 --- a/src/tuntap/tun_windows.go +++ b/src/tuntap/tun_windows.go @@ -2,8 +2,6 @@ package tuntap -// This is to catch Windows platforms - import ( "bytes" "errors" @@ -18,7 +16,7 @@ import ( "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" ) -const TUN_OFFSET_BYTES = 4 +// This is to catch Windows platforms // Configures the TUN adapter with the correct IPv6 address and MTU. func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {