tun_gvisor.go 364 B

12345678910111213141516171819
  1. //go:build with_gvisor && linux
  2. package libbox
  3. import (
  4. "github.com/sagernet/sing-tun"
  5. "gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
  6. "gvisor.dev/gvisor/pkg/tcpip/stack"
  7. )
  8. var _ tun.GVisorTun = (*nativeTun)(nil)
  9. func (t *nativeTun) NewEndpoint() (stack.LinkEndpoint, error) {
  10. return fdbased.New(&fdbased.Options{
  11. FDs: []int{t.tunFd},
  12. MTU: t.tunMTU,
  13. })
  14. }