aboutsummaryrefslogtreecommitdiffstats
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-10 21:30:23 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-10 21:30:23 +0200
commit2d847a38a29ed413f5907cc411c9ff4752001212 (patch)
tree013b3a63692059ffbe1c275437dbd157e9512c2d /tun/tun_windows.go
parentwintun: enumerate faster by using COMPATDRIVER instead of CLASSDRIVER (diff)
downloadwireguard-go-2d847a38a29ed413f5907cc411c9ff4752001212.tar.xz
wireguard-go-2d847a38a29ed413f5907cc411c9ff4752001212.zip
wintun: add LUID accessor
Diffstat (limited to '')
-rw-r--r--tun/tun_windows.go7
1 files changed, 7 insertions, 0 deletions
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)
+}