Files
amnezia-tun2socks/core/device/fdbased/open_others.go
albexk 9fabebb17e Modifications for libxray (#2)
* Rename module and move to awg
2024-06-18 14:37:09 +01:00

24 lines
463 B
Go

//go:build !linux && !windows
package fdbased
import (
"fmt"
"os"
"github.com/amnezia-vpn/amnezia-tun2socks/v2/core/device"
"github.com/amnezia-vpn/amnezia-tun2socks/v2/core/device/iobased"
)
func open(fd int, mtu uint32) (device.Device, error) {
f := &FD{fd: fd, mtu: mtu}
ep, err := iobased.New(os.NewFile(uintptr(fd), f.Name()), mtu, 0)
if err != nil {
return nil, fmt.Errorf("create endpoint: %w", err)
}
f.LinkEndpoint = ep
return f, nil
}