ep *channel.Endpoint
stack *stack.Stack
events chan tun.Event
+ notifyHandle *channel.NotificationHandle
incomingPacket chan *buffer.View
mtu int
dnsServers []netip.Addr
if tcpipErr != nil {
return nil, nil, fmt.Errorf("could not enable TCP SACK: %v", tcpipErr)
}
- dev.ep.AddNotify(dev)
+ dev.notifyHandle = dev.ep.AddNotify(dev)
tcpipErr = dev.stack.CreateNIC(1, dev.ep)
if tcpipErr != nil {
return nil, nil, fmt.Errorf("CreateNIC: %v", tcpipErr)
func (tun *netTun) Close() error {
tun.stack.RemoveNIC(1)
+ tun.stack.Close()
+ tun.ep.RemoveNotify(tun.notifyHandle)
+ tun.ep.Close()
if tun.events != nil {
close(tun.events)
}
- tun.ep.Close()
-
if tun.incomingPacket != nil {
close(tun.incomingPacket)
}