wireguard-go/tun/tun_default.go
Simon Rozman 91b4e909bb wintun: Use native Win32 API for I/O
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-21 00:56:45 +01:00

25 lines
500 B
Go

// +build !windows
/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/
package tun
import (
"fmt"
)
func (tun *NativeTun) operateOnFd(fn func(fd uintptr)) {
sysconn, err := tun.tunFile.SyscallConn()
if err != nil {
tun.errors <- fmt.Errorf("unable to find sysconn for tunfile: %s", err.Error())
return
}
err = sysconn.Control(fn)
if err != nil {
tun.errors <- fmt.Errorf("unable to control sysconn for tunfile: %s", err.Error())
}
}