wintun: Resolve some of golint warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman
2019-03-04 14:27:16 +01:00
committed by Jason A. Donenfeld
parent a1aabb21ae
commit 1fdf7b19a3
4 changed files with 33 additions and 17 deletions

View File

@@ -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)
}