mirror of
https://github.com/yggdrasil-network/water.git
synced 2025-05-19 16:35:10 +03:00
use blocking mode pre-go1.11
This commit is contained in:
parent
240a3d7b51
commit
3fe638a7bf
13 changed files with 132 additions and 95 deletions
26
syscalls_linux_legacy.go
Normal file
26
syscalls_linux_legacy.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
// +build linux,!go1.11
|
||||
|
||||
package water
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func openDev(config Config) (ifce *Interface, err error) {
|
||||
var file *os.File
|
||||
if file, err = os.OpenFile(
|
||||
"/dev/net/tun", os.O_RDWR, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name, err := setupFd(config, file.Fd())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Interface{
|
||||
isTAP: config.DeviceType == TAP,
|
||||
ReadWriteCloser: file,
|
||||
name: name,
|
||||
}, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue