- API
- ProxyServer ⇐ EventEmitter
- new ProxyServer(httpPort, httpsPort)
- proxyServer.start([config]) ⇒ Promise
- proxyServer.stop() ⇒ ProxyServer
- proxyServer.restart() ⇒ ProxyServer
- proxyServer.addHostsFile(filePath) ⇒ ProxyServer
- proxyServer.addRewriteFile(filePath) ⇒ ProxyServer
- proxyServer.openBrowser(browserName, url, [usePacProxy]) ⇒ ProxyServer
- proxyServer.enableConfFile(confFileType, filePath) ⇒ ProxyServer
- proxyServer.disableConfFile(confFileType, filePath) ⇒ ProxyServer
- ProxyServer ⇐ EventEmitter
API
如果你愿意帮助hiproxy编写文档,请联系zdying@live.com, 谢谢!
If you are willing to help hiproxy to write documentation, please contact zdying@live.com, thank you!
ProxyServer ⇐ EventEmitter
Kind : global classExtends : EventEmitter
- ProxyServer ⇐
EventEmitter- new ProxyServer(httpPort, httpsPort)
- .start(httpPort, httpsPort) ⇒
Promise - .stop() ⇒
ProxyServer - .restart() ⇒
ProxyServer - .addHostsFile(filePath) ⇒
ProxyServer - .addRewriteFile(filePath) ⇒
ProxyServer - .openBrowser(browserName, url, [usePacProxy]) ⇒
ProxyServer - .enableConfFile(confFileType, filePath) ⇒
ProxyServer - .disableConfFile(confFileType, filePath) ⇒
ProxyServer
new ProxyServer(httpPort, httpsPort)
hiproxy代理服务器
| Param | Type | Description || — | — | — || options | Object | 配置参数 || options.httpPort | Number | http代理服务端口号,如果传递0/null/undefined,将会自动分配一个可用端口号 || options.httpsPort | Number | https代理服务端口号,如果传递0,将会自动分配一个可用端口号,如果传递null或者undefined,不启动https服务。 || [options.dir] | String | hiproxy工作空间,默认为当前工作目录(process.cwd()) |
proxyServer.start([config]) ⇒ Promise
启动代理服务
Kind : instance method of ProxyServerAccess : public
| Param | Type | Description || — | — | — || config | Object | 配置字段 |
proxyServer.stop() ⇒ ProxyServer
停止代理服务
Kind : instance method of ProxyServerAccess : public
proxyServer.restart() ⇒ ProxyServer
重启代理服务
Kind : instance method of ProxyServerAccess : public
proxyServer.addHostsFile(filePath) ⇒ ProxyServer
添加Hosts文件
Kind : instance method of ProxyServerAccess : public
| Param | Type | Description || — | — | — || filePath | String | Array | hosts文件路径(绝对路径) |
proxyServer.addRewriteFile(filePath) ⇒ ProxyServer
添加rewrite文件
Kind : instance method of ProxyServerAccess : public
| Param | Type | Description || — | — | — || filePath | String | Array | rewrite文件路径(绝对路径) |
proxyServer.openBrowser(browserName, url, [usePacProxy]) ⇒ ProxyServer
打开浏览器窗口
Kind : instance method of ProxyServerAccess : public
| Param | Type | Default | Description || — | — | — | — || browserName | String | | 浏览器名称 || url | String | | 要打开的url || [usePacProxy] | Boolean | false | 是否使用自动代理 |
proxyServer.enableConfFile(confFileType, filePath) ⇒ ProxyServer
启用指定配置文件
Kind : instance method of ProxyServerAccess : public
| Param | Type | Default | Description || — | — | — | — || confFileType | String | | 文件类型(host/rewrite) || filePath | String | Array | | 修改的文件路径 |
proxyServer.disableConfFile(confFileType, filePath) ⇒ ProxyServer
禁用指定配置文件
Kind : instance method of ProxyServerAccess : public
| Param | Type | Default | Description || — | — | — | — || confFileType | String | | 文件类型(host/rewrite) || filePath | String | Array | | 修改的文件路径 |
