diff --git a/daemon/vpn/nordlynx/libtelio/libtelio.go b/daemon/vpn/nordlynx/libtelio/libtelio.go index 14c01b56..53c29a33 100644 --- a/daemon/vpn/nordlynx/libtelio/libtelio.go +++ b/daemon/vpn/nordlynx/libtelio/libtelio.go @@ -331,7 +331,11 @@ func (l *Libtelio) State() vpn.State { func (l *Libtelio) Tun() tunnel.T { l.mu.Lock() defer l.mu.Unlock() - return l.tun + if l.tun != nil { + return l.tun + } + + return nil } // Enable initiates the tunnel if it is not initiated yet. It can be diff --git a/daemon/vpn/openvpn/openvpn.go b/daemon/vpn/openvpn/openvpn.go index 73a49caa..ff862a1a 100644 --- a/daemon/vpn/openvpn/openvpn.go +++ b/daemon/vpn/openvpn/openvpn.go @@ -291,7 +291,10 @@ func (ovpn *OpenVPN) setTun(tun tunnel.Tunnel) { func (ovpn *OpenVPN) Tun() tunnel.T { ovpn.Lock() defer ovpn.Unlock() - return ovpn.tun + if ovpn.tun != nil { + return ovpn.tun + } + return nil } func (ovpn *OpenVPN) setState(arg string) {