我正在创建一个连接到VPN服务器的应用程序.我已经弄清楚如何做到这一点,但需要能够通过连接发送所有流量.有没有可以做到这一点的代码?到目前为止,我尝试过:
let manager: NEVPNManager = NEVPNManager.sharedManager()
var p = NEVPNProtocolIPSec()
manager.`protocol` = p
let pw = ""
p.username = ""
p.passwordReference = pw.dataUsingEncoding(NSUTF8StringEncoding)
p.serverAddress = ""
p.authenticationMethod = NEVPNIKEAuthenticationMethod.SharedSecret
//p.sharedSecretReference = getPasscodeNSData("vpnSharedSecret")
p.useExtendedAuthentication = true
p.disconnectOnSleep = false
Run Code Online (Sandbox Code Playgroud) 我正在创建一个游戏,它需要无限数量的矩形.例如,假设我将变量命名为car:
public Rectangle car1;
public Rectangle car2;
public Rectangle car3;
Run Code Online (Sandbox Code Playgroud)
等等,
会有更简单的方法吗?喜欢:
public int carNumber;
public Rectange car + carNumber;//if carNumber was one, it would be called car1
Run Code Online (Sandbox Code Playgroud)
另外,我需要测试矩形是否包含其他矩形.< - 我知道怎么做.