* Is there a Delegate for the Wireguard status in PacketTunnelProvider (iOS)
@ 2022-02-19 17:34 Houman
0 siblings, 0 replies; only message in thread
From: Houman @ 2022-02-19 17:34 UTC (permalink / raw)
To: WireGuard mailing list
Hello,
I wonder if there is a Delegate we could use in PacketTunnelProvider
to observe the state of Wireguard VPN.
For example OpenVPN has something like this:
extension PacketTunnelProvider: OpenVPNAdapterDelegate {
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleEvent
event: OpenVPNAdapterEvent, message: String?) {
switch event {
case .connected:
case .disconnected:
case .reconnecting:
default:
break
}
}
}
Do we have this in Wireguard?
I know it's possible to subscribe to this NEVPNStatusDidChange in the
main app instead:
override func viewDidLoad() {
NotificationCenter.default.addObserver(self, selector:
#selector(vpnStatusDidChange(_:)), name:
NSNotification.Name.NEVPNStatusDidChange, object: nil)
}
But this doesn't work well for Third party VPNs that integrate over
the NetworkExtension framework. Even though I have observed this once,
I see multiple connected states being triggered, after connecting a
single time to the VPN.
@objc private func vpnStatusDidChange(_ notification: Notification) {
let nevpnconn = notification.object as! NEVPNConnection
let status = nevpnconn.status
switch status {
case NEVPNStatus.invalid:
case NEVPNStatus.disconnected:
case NEVPNStatus.connecting:
case NEVPNStatus.connected:
...
}
Any suggestions please?
Thanks,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-19 17:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19 17:34 Is there a Delegate for the Wireguard status in PacketTunnelProvider (iOS) Houman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).