Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

请问 server.start() 之后为什么还是打不开网站呢? #30

Closed
tigerZhangy opened this issue Dec 1, 2016 · 8 comments
Closed

Comments

@tigerZhangy
Copy link

我使用 xcode 8.1 导入了 NEKit,完全按照示例代码运行了 server.start()。
确认了 https 服务器和我的账户都没有问题,应用退出到后台后使用 safari 依然无法打开 facebook,手机状态栏中也没有出现 VPN 的标识。
请问这是为什么呢?在代码运行完成之后是否还需要做其他的工作?

代码如下:

DDLog.removeAllLoggers()
DDLog.add(DDTTYLogger.sharedInstance(), with: .info)
        
ObserverFactory.currentFactory = DebugObserverFactory()
let auth = HTTPAuthentication(username: "tztest", password: "123")
let secureHttpAdapterFactory = SecureHTTPAdapterFactory(serverHost: "us.xxx.com", serverPort: 443, auth: auth)
        
let allRule = AllRule(adapterFactory: secureHttpAdapterFactory)
let manager = RuleManager(fromRules: [allRule], appendDirect: true)
        
RuleManager.currentManager = manager
httpsProxy = GCDHTTPProxyServer(address: IPv4Address(fromString:"127.0.0.1"), port: 9090)

try! httpsProxy!.start()

产生的日志如下:

Proxy server <GCDHTTPProxyServer address:Optional(<IPv4Address 127.0.0.1>) port:<Port 9090>> started.

谢谢。

@HTMLtargetblank
Copy link

你配置中还需要配置一些参数..可以参考土豆丝的源代码

@zhuhaow
Copy link
Owner

zhuhaow commented Dec 2, 2016

@zhuhaow zhuhaow closed this as completed Dec 2, 2016
@tigerZhangy
Copy link
Author

我看到文档里面说:

NEKit does not depend on Network Extension framework. You can use NEKit without Network Extension entitlement to build a rule based proxy in a few lines.

但是看这个 Issue,还是需要苹果的 Network Extension 的,并不是简单几行代码就可以了,是这样吗?

@zhuhaow
Copy link
Owner

zhuhaow commented Dec 2, 2016 via email

@tigerZhangy
Copy link
Author

和 Network Extension 的结合可以再详细说一下吗?谢谢

@broccolii
Copy link

所以在 iOS上使用 NEKit 还是需要申请 entitlement 对么?

@zhuhaow
Copy link
Owner

zhuhaow commented Jan 18, 2017

上网站上加一下就好了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants