关于iOS VPN开发[随进度更新]

来源:互联网 发布:声音对比分析软件 编辑:程序博客网 时间:2024/05/29 17:37
iOS9.x后原来用的SSL VPN失效,不知道苹果又做了什么限制,不得不才用新的方法.翻遍了整个Google也没有找到相关的开发经验谈,最后还是在苹果官网找到了模版SimpleTunnel,其实xcode的documentation里面也有哦,搜索便可查到.这个例子主要是用自定义协议而不是系统API定义好的iPSec等等那几个,如果系统定义好的协议能满足,则可不必如此费周折.然而官方的例子都是用swift语言编写.那么,第一个问题来了,我对swift一点了解也没有,不得不去自学,嘤嘤嘤...
例子一共有几个模块:
AppProxy,SimpleTunnel,PacketTunnel,SimpleTunnelServices,tunnel_server,FilterDataProvider.
用到的API如官方解释:

- Use the NEPacketTunnelProvider class to implement a custom VPN tunneling protocol. 

- Use the NETunnelProviderManager class to create and manage VPN configurations that use the custom VPN tunneling protocol. 

- Use the NEAppProxyProvider class to implement a custom transparent network proxy protocol.

 - Use the NEAppProxyProviderManager class to manage VPN configurations that use the transparent network proxy protocol. 

- Use the NEFilterControlProvider andNEFilterDataProvider classes to implement a custom on-device content filtering service. 

- Use the NEFilterManager class to configure the custom filtering service.
这就不必翻译了吧.
其次,需要了解这个例子是如何工作的,配好证书和每个target的描述文件以及bid,运行,成功,能看到这个例子实现的功能,能添加哪些参数.然而不知道什么原因还未添加成功,还需要进一步了解.
再者,考虑相关的项目是由oc编写,设计的swift如果比较多就用混编,如果较少则可自行翻译成oc.


之前由于不认真,没有认真阅读readme,里面提到如果要运行SimpleTunnel.app,需要获得苹果的授权使用NetworkExtension的APIs,那么就需要发送邮件到

networkextension@apple.com,然后你会收到一封auto ACK,填好后,再发过去,等一段时间(不会超过一个月)你将收到允许或不允许使用的答复.我尝试过给苹果中国技术支持的客服打电话, 人家没有权利授权这个功能,所以只有发这个邮件了.

0 0
原创粉丝点击