Kind: global classExtends:
- ProxyServer ⇐
EventEmitter
hiproxy代理服务器
| Param | Type | Description || — | — | — || options | Object
| 配置参数 || options.httpPort | Number
| http代理服务端口号,如果传递0
/null
/undefined
,将会自动分配一个可用端口号 || options.httpsPort | | https代理服务端口号,如果传递0,将会自动分配一个可用端口号,如果传递null
或者undefined
,不启动https服务。 || [options.dir] | String
| hiproxy工作空间,默认为当前工作目录(process.cwd()
) |
proxyServer.start([config]) ⇒ Promise
启动代理服务
Kind: instance method of Access: public
| Param | Type | Description || — | — | — || config | Object
| 配置字段 |
proxyServer.stop() ⇒ ProxyServer
Kind: instance method of ProxyServer
Access: public
重启代理服务
Kind: instance method of ProxyServer
Access: public
proxyServer.addHostsFile(filePath) ⇒ ProxyServer
添加Hosts文件
Kind: instance method of Access: public
| Param | Type | Description || — | — | — || filePath | String
| Array
| hosts
文件路径(绝对路径) |
proxyServer.addRewriteFile(filePath) ⇒ ProxyServer
添加rewrite文件
Kind: instance method of ProxyServer
Access: public
| Param | Type | Description || — | — | — || filePath | String
| | rewrite
文件路径(绝对路径) |
打开浏览器窗口
Kind: instance method of Access: public
| Param | Type | Default | Description || — | — | — | — || browserName | String
| | 浏览器名称 || url | String
| | 要打开的url || [usePacProxy] | Boolean
| false
| 是否使用自动代理 |
proxyServer.enableConfFile(confFileType, filePath) ⇒ ProxyServer
启用指定配置文件
Kind: instance method of ProxyServer
Access: public
| Param | Type | Default | Description || — | — | — | — || confFileType | String
| | 文件类型(host/rewrite) || filePath | String
| Array
| | 修改的文件路径 |
proxyServer.disableConfFile(confFileType, filePath) ⇒ ProxyServer
禁用指定配置文件
Kind: instance method of Access: public