diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-10 21:30:23 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-10 21:30:23 +0200 |
commit | 2d847a38a29ed413f5907cc411c9ff4752001212 (patch) | |
tree | 013b3a63692059ffbe1c275437dbd157e9512c2d | |
parent | 7a8553aef00449867816fdbba54a02ae748eefca (diff) |
wintun: add LUID accessor
-rw-r--r-- | tun/tun_windows.go | 7 |
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) +} |