diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-22 14:09:16 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-22 14:16:06 +0100 |
commit | c27bf0bf4b5ade08c6c8b6ff679c2ec97b0186e0 (patch) | |
tree | d2e4e15bd15b18ce4e2feb80dbd4f847eed6f423 | |
parent | 756958d857f868792bacdf13f4af2846d1e2bdb7 (diff) | |
download | wireguard-go-c27bf0bf4b5ade08c6c8b6ff679c2ec97b0186e0.tar.gz wireguard-go-c27bf0bf4b5ade08c6c8b6ff679c2ec97b0186e0.zip |
tun: make customization of WintunPool and WintunGUID more obvious
Persnickety consumers can now do:
func init() {
tun.WintunPool, _ = wintun.Pool("Flurp")
tun.WintunStaticRequestedGUID, _ = windows.GUIDFromString("{5ae2716f-0b3e-4dc4-a8b5-48eba11a6e16}")
}
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | tun/tun_windows.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 238bee0..e66ae8e 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -44,15 +44,8 @@ type NativeTun struct { readWait windows.Handle } -var WintunPool *wintun.Pool - -func init() { - var err error - WintunPool, err = wintun.MakePool("WireGuard") - if err != nil { - panic(fmt.Errorf("Failed to make pool: %w", err)) - } -} +var WintunPool, _ = wintun.MakePool("WireGuard") +var WintunStaticRequestedGUID *windows.GUID //go:linkname procyield runtime.procyield func procyield(cycles uint32) @@ -65,7 +58,7 @@ func nanotime() int64 // interface with the same name exist, it is reused. // func CreateTUN(ifname string, mtu int) (Device, error) { - return CreateTUNWithRequestedGUID(ifname, nil, mtu) + return CreateTUNWithRequestedGUID(ifname, WintunStaticRequestedGUID, mtu) } // |