Package Exports
- hiproxy
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hiproxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hiproxy
A Node.js proxy client
Install
npm install -g hiproxyUsage
- Start proxy server
cd your_workspace
hiproxy start -p 5525 --debug- Config proxy
127.0.0.1:5525API
ProxyServer ⇐ EventEmitter
Kind: global class
Extends: EventEmitter
- ProxyServer ⇐
EventEmitter
new ProxyServer(httpPort, httpsPort)
hiproxy代理服务器
| Param | Type | Description |
|---|---|---|
| httpPort | Number |
http代理服务端口号 |
| httpsPort | Number |
https代理服务器端口号 |
proxyServer.start(httpPort, httpsPort) ⇒ Promise
启动代理服务
Kind: instance method of ProxyServer
Access: public
| Param | Type | Description |
|---|---|---|
| httpPort | Number |
http服务端口号 |
| httpsPort | Number |
https服务端口号 |
proxyServer.stop() ⇒ ProxyServer
停止代理服务
Kind: instance method of ProxyServer
Access: public
proxyServer.restart() ⇒ ProxyServer
重启代理服务
Kind: instance method of ProxyServer
Access: public
proxyServer.addHostsFile(filePath) ⇒ ProxyServer
添加Hosts文件
Kind: instance method of ProxyServer
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 | Array |
rewrite文件路径(绝对路径) |
proxyServer.openBrowser(browserName, url, [usePacProxy]) ⇒ ProxyServer
打开浏览器窗口
Kind: instance method of ProxyServer
Access: public
| Param | Type | Default | Description |
|---|---|---|---|
| browserName | String |
浏览器名称 | |
| url | String |
要打开的url | |
| [usePacProxy] | Boolean |
false |
是否使用自动代理 |
proxyServer.findConfigFiels([dir]) ⇒ ProxyServer
在指定工作空间(目录)下查找配置文件 hiproxy会在指定的空间下所有一级目录下查找配置文件
Kind: instance method of ProxyServer
Access: public
| Param | Type | Default | Description |
|---|---|---|---|
| [dir] | String |
process.cwd() |
工作空间(目录) |
Events
- "start"
- "stop"
- "addHostsFile"
- "addRewriteFile"
- "creatPacFile"
- "httpsRequest"
- "connect"
- "setResponse"
- "request"
- "getProxyInfo"
- "setRequest"
- "setResponse"
- "data"
- "data"
- "data"
- "response"
"start"
Emitted when the hiproxy server(s) start.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| servers | Array |
http/https server |
| localIP | String |
the local ip address |
"stop"
Emitted when the hiproxy server(s) stop.
Kind: event emitted by ProxyServer
"addHostsFile"
Emitted when add hosts file.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| filePath | Array | String |
rewrite file path(s) |
"addRewriteFile"
Emitted when add rewrite file.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| filePath | Array | String |
rewrite file path(s) |
"creatPacFile"
Emitter when the pac proxy file is created or updated.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| domains | Object |
domain list |
"httpsRequest"
Emitted each time there is a request to the https server.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| request | http.IncomingMessage |
request object |
| response | http.ServerResponse |
response object |
"connect"
Emitted each time the server responds to a request with a CONNECT method.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| request | http.IncomingMessage |
request object |
| socket | net.Socket |
socket object |
| head | Buffer |
head |
"setResponse"
Emitted each time the server set response info (eg: headers).
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| response | http.ServerResponse |
request object |
"request"
Emitted each time there is a request.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| request | http.IncomingMessage |
request object |
| response | http.ServerResponse |
response object |
"getProxyInfo"
Emitted each time the hiproxy server get proxy info for current request.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| proxyInfo | Object |
proxy info object |
"setRequest"
Emitted each time the hiproxy server set request options (eg: headers and host) before request data from remote server
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| request | http.IncomingMessage |
request |
| proxyOptions | Object |
the proxy header options |
"setResponse"
Emitted each time the server set response info (eg: headers).
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| response | http.ServerResponse |
request object |
"data"
Emitted whenever the response stream received some chunk of data.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| data | Buffer |
response data |
"data"
Emitted whenever the response stream received some chunk of data.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| data | Buffer |
response data |
"data"
Emitted whenever the response stream received some chunk of data.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| data | Buffer |
response data |
"response"
Emitted when a response is end. This event is emitted only once.
Kind: event emitted by ProxyServer
Properties
| Name | Type | Description |
|---|---|---|
| response | http.ServerResponse |
response object |