From 2d847a38a29ed413f5907cc411c9ff4752001212 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 10 May 2019 21:30:23 +0200 Subject: [PATCH] wintun: add LUID accessor --- tun/tun_windows.go | 7 +++++++ 1 file changed, 7 insertions(+) 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) +}