aboutsummaryrefslogtreecommitdiffstats
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'tun/tun_windows.go')
-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 e2752db..4c48af5 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -52,6 +52,10 @@ func packetAlign(size uint32) uint32 {
return (size + (packetExchangeAlignment - 1)) &^ (packetExchangeAlignment - 1)
}
+//
+// CreateTUN creates a Wintun adapter with the given name. Should a Wintun
+// adapter with the same name exist, it is reused.
+//
func CreateTUN(ifname string) (TUNDevice, error) {
// Does an interface with this name already exist?
wt, err := wintun.GetInterface(ifname, 0)
@@ -351,6 +355,9 @@ func (tun *NativeTun) Write(buff []byte, offset int) (int, error) {
return len(buff) - offset, tun.flush()
}
+//
+// GUID returns Windows adapter instance ID.
+//
func (tun *NativeTun) GUID() windows.GUID {
return *(*windows.GUID)(tun.wt)
}