Make gVisor optional
This commit is contained in:
parent
057dd738a7
commit
0e80d729a3
11 changed files with 23 additions and 26 deletions
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue