Fix system nat mapping

This commit is contained in:
世界 2023-04-18 21:21:59 +08:00
parent bf7110b1ab
commit 53f50347e0
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
4 changed files with 60 additions and 23 deletions

View file

@ -57,7 +57,7 @@ func NewGVisor(
return nil, E.New("gVisor stack is unsupported on current platform")
}
return &GVisor{
gStack := &GVisor{
ctx: options.Context,
tun: gTun,
tunMtu: options.MTU,
@ -66,8 +66,11 @@ func NewGVisor(
router: options.Router,
handler: options.Handler,
logger: options.Logger,
routeMapping: NewRouteMapping(options.UDPTimeout),
}, nil
}
if gStack.router != nil {
gStack.routeMapping = NewRouteMapping(options.Context, options.UDPTimeout)
}
return gStack, nil
}
func (t *GVisor) Start() error {