platform: Fix build on windows

This commit is contained in:
世界 2023-04-07 21:10:16 +08:00
parent 72dbf2e2b4
commit 5bf177b021
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 17 additions and 1 deletions

View file

@ -79,7 +79,7 @@ func (w *platformInterfaceWrapper) OpenTun(options tun.Options, platformOptions
if err != nil {
return nil, err
}
dupFd, err := syscall.Dup(int(tunFd))
dupFd, err := dup(int(tunFd))
if err != nil {
return nil, E.Cause(err, "dup tun file descriptor")
}

View file

@ -0,0 +1,9 @@
//go:build !windows
package libbox
import "syscall"
func dup(fd int) (nfd int, err error) {
return syscall.Dup(fd)
}

View file

@ -0,0 +1,7 @@
package libbox
import "os"
func dup(fd int) (nfd int, err error) {
return 0, os.ErrInvalid
}