Make gVisor optional

This commit is contained in:
世界 2022-09-15 11:19:31 +08:00
parent 057dd738a7
commit 0e80d729a3
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
11 changed files with 23 additions and 26 deletions

View file

@ -1,4 +1,4 @@
//go:build !(no_gvisor || !(linux || windows || darwin))
//go:build with_gvisor
package tun
@ -22,6 +22,8 @@ import (
"gvisor.dev/gvisor/pkg/waiter"
)
const WithGVisor = true
const defaultNIC tcpip.NICID = 1
type GVisor struct {
@ -45,7 +47,7 @@ func NewGVisor(
) (Stack, error) {
gTun, isGTun := options.Tun.(GVisorTun)
if !isGTun {
return nil, ErrGVisorUnsupported
return nil, E.New("gVisor stack is unsupported on current platform")
}
return &GVisor{