我有一个 NEVPNProtocolIKEv2 连接。如何配置规则,以便在 10 分钟后断开连接?
let providerManagerIKEv2 = NEVPNProtocolIKEv2()
providerManagerIKEv2.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
providerManagerIKEv2.serverAddress = "ip address"
providerManagerIKEv2.disconnectOnSleep = false
providerManagerIKEv2.deadPeerDetectionRate = NEVPNIKEv2DeadPeerDetectionRate.medium
providerManagerIKEv2.sharedSecretReference = KeychainWrapper.standard.dataRef(forKey: "sharedSecretIKEv2")
providerManagerIKEv2.disableMOBIKE = false
providerManagerIKEv2.disableRedirect = false
providerManagerIKEv2.enableRevocationCheck = false
providerManagerIKEv2.enablePFS = false
providerManagerIKEv2.useExtendedAuthentication = true
providerManagerIKEv2.useConfigurationAttributeInternalIPSubnet = false
providerManagerIKEv2.remoteIdentifier = DataManager.sharedInstance.configServer.remoteID
providerManagerIKEv2.localIdentifier = DataManager.sharedInstance.configServer.localID
providerManagerIKEv2.username = DataManager.sharedInstance.configServer.username
providerManagerIKEv2.passwordReference = KeychainWrapper.standard.dataRef(forKey: "password")
self.loadProfileIKEv2 { _ in
self.manager.protocolConfiguration = providerManagerIKEv2
self.manager.onDemandRules = [NEOnDemandRuleConnect()]
self.manager.isOnDemandEnabled = false
self.manager.isEnabled = true
self.manager.localizedDescription = "VPN"
}