Add tun inbound for linux
This commit is contained in:
16
common/tun/gvisor_linux.go
Normal file
16
common/tun/gvisor_linux.go
Normal 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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user