diff --git a/gvisor.go b/gvisor.go index cf4b675..c5b8092 100644 --- a/gvisor.go +++ b/gvisor.go @@ -30,6 +30,7 @@ type GVisorTun struct { endpointIndependentNatTimeout int64 handler Handler stack *stack.Stack + endpoint stack.LinkEndpoint } func NewGVisor( @@ -158,10 +159,12 @@ func (t *GVisorTun) Start() error { } t.stack = ipStack + t.endpoint = linkEndpoint return nil } func (t *GVisorTun) Close() error { + t.endpoint.Attach(nil) t.stack.Close() for _, endpoint := range t.stack.CleanupEndpoints() { endpoint.Abort() diff --git a/monitor_linux.go b/monitor_linux.go index be5d962..5c97709 100644 --- a/monitor_linux.go +++ b/monitor_linux.go @@ -63,9 +63,6 @@ func (m *networkUpdateMonitor) Start() error { if err != nil { return err } - if err != nil { - return err - } go m.loopUpdate() return nil }