This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isVPNConnected() -> Bool { | |
let cfDict = CFNetworkCopySystemProxySettings() | |
let nsDict = cfDict!.takeRetainedValue() as NSDictionary | |
let keys = nsDict["__SCOPED__"] as! NSDictionary | |
for key: String in keys.allKeys as! [String] { | |
if (key == "tap" || key == "tun" || key == "ppp" || key == "ipsec" || key == "ipsec0") { | |
return true | |
} | |
} |