1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-12 10:50:43 +00:00
v2fly/app/tun/nic.go
2023-10-22 22:44:28 +01:00

20 lines
419 B
Go

package tun
import (
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/stack"
)
func CreateNIC(nicID tcpip.NICID, linkEndpoint stack.LinkEndpoint) StackOption {
return func(s *stack.Stack) error {
if err := s.CreateNICWithOptions(nicID, linkEndpoint,
stack.NICOptions{
Disabled: false,
QDisc: nil,
}); err != nil {
return newError("failed to create NIC:", err)
}
return nil
}
}