github.com/MerlinKodo/sing-tun@v0.1.15/tun_linux_gvisor.go (about)

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