以编程方式检测 iphone/ipad 是否通过公共 wifi 连接到 VPN
我们有一个应用程序,其中某些功能仅当用户连接到与其帐户关联的路由器时才需要工作(我们有一些有关用户帐户和家庭路由器的信息)。 但是,用户可以通过任何公共 WiFi/3G 网络建立与其家庭路由器的 VPN 连接。如果是这种情况,我们希望阻止某些功能。
关于如何使用任何现有的 iphone/ipad api 检测它有什么想法吗?
谢谢, 赫塔尔
We have an app wherein certain functionality needs to work only when the user is connected to a router associated with his account (we have some information about user accounts and home routers).
However, it is possible for the user to set up a VPN connection to his home router via any public wifi/3g network. We want to block certain functionality if that is the case.
Any ideas as to how it can be detected using any of the existing iphone/ipad apis?
Thanks,
Hetal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可达性 API 中有一个名为 kSCNetworkReachabilityFlagsTransientConnection 的标志。
当您通过 VPN 连接时,该值为 true;如果您未通过 VPN 连接,则为 false。
我们使用此标志值来检查我们的条件。
There is a flag in the reachability API called kSCNetworkReachabilityFlagsTransientConnection.
It is true when you are connected via a VPN and false if you are not connected via a VPN.
We used this flag value to check for our conditions.
没有 iOS API(至少是公共的)可以为您提供有关您是在家庭路由器还是公共 WiFi 连接上运行的信息。您只能确定您使用的是 WiFi 连接还是 3G 连接。 (例如,请参阅 可达性示例)
您也许可以根据设备当前的 IP 地址进行某种查找。您必须让每个用户注册其路由器的 IP 地址,并让您的应用程序在运行之前对其进行验证,等等。但是,仍然无法保证用户的家庭路由器是安全的。换句话说,它可以像公共 WiFi 一样开放。
There's no iOS API (public at least) that is going to give you information on whether you're running on a home router or public WiFi connection. You can only determine that you're on a WiFi connection vs. 3G. (for example, see the Reachability sample)
You might be able to do some sort of lookup based on the device's current IP address. You'd have to have each user register their router's IP address and have your application validate it before running, etc. But still, there'd be no guarantee that user's home router is secured. In other words, it could be just as wide open as a public WiFi.