mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 18:11:28 +00:00
20 lines
364 B
Go
20 lines
364 B
Go
//go:build with_gvisor && linux
|
|
|
|
package libbox
|
|
|
|
import (
|
|
"github.com/sagernet/sing-tun"
|
|
|
|
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
|
)
|
|
|
|
var _ tun.GVisorTun = (*nativeTun)(nil)
|
|
|
|
func (t *nativeTun) NewEndpoint() (stack.LinkEndpoint, error) {
|
|
return fdbased.New(&fdbased.Options{
|
|
FDs: []int{t.tunFd},
|
|
MTU: t.tunMTU,
|
|
})
|
|
}
|