Add tun inbound for linux

This commit is contained in:
世界
2022-07-09 19:18:37 +08:00
parent cee09c6e9d
commit 6795fe15dd
19 changed files with 623 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
//go:build linux
package tun
import (
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
"gvisor.dev/gvisor/pkg/tcpip/stack"
)
func NewEndpoint(tunFd uintptr, tunMtu uint32) (stack.LinkEndpoint, error) {
return fdbased.New(&fdbased.Options{
FDs: []int{int(tunFd)},
MTU: tunMtu,
PacketDispatchMode: fdbased.PacketMMap,
})
}