From: Jason A. Donenfeld Date: Fri, 10 May 2019 19:30:23 +0000 (+0200) Subject: wintun: add LUID accessor X-Git-Tag: 0.0.20190517~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d847a38a29ed413f5907cc411c9ff4752001212;p=thirdparty%2Fwireguard-go.git wintun: add LUID accessor --- diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 8218fc3..03e04a2 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -373,3 +373,10 @@ func (tun *NativeTun) Write(buff []byte, offset int) (int, error) { func (tun *NativeTun) GUID() windows.GUID { return tun.wt.CfgInstanceID } + +// +// GUID returns Windows adapter instance ID. +// +func (tun *NativeTun) LUID() uint64 { + return ((uint64(tun.wt.LUIDIndex) & ((1 << 24) - 1)) << 24) | ((uint64(tun.wt.IfType) & ((1 << 16) - 1)) << 48) +}