Node.js API

If you are willing to help hiproxy to write documentation, please contact zdying@live.com, thank you!

ProxyServer ⇐ EventEmitter

Kind: global class
Extends: EventEmitter

new ProxyServer(httpPort, httpsPort)

Hiproxy’s proxy server.

Param Type Description
httpPort Number proxy server port for http
httpsPort Number proxy server port for https

proxyServer.start([config]) ⇒ Promise

Start proxy server.

Kind: instance method of ProxyServer
Access: public

Param Type Description
config Object configuration fields

proxyServer.stop() ⇒ ProxyServer

Stop proxy server.

Kind: instance method of ProxyServer
Access: public

proxyServer.restart() ⇒ ProxyServer

Restart proxy server.

Kind: instance method of ProxyServer
Access: public

proxyServer.addHostsFile(filePath) ⇒ ProxyServer

Add a hosts file.

Kind: instance method of ProxyServer
Access: public

Param Type Description
filePath String \ Array hosts file path(s) (absolute)

proxyServer.addRewriteFile(filePath) ⇒ ProxyServer

Add a rewrite file.

Kind: instance method of ProxyServer
Access: public

Param Type Description
filePath String \ Array rewrite file path(s) (absolute)

proxyServer.openBrowser(browserName, url, [usePacProxy]) ⇒ ProxyServer

Open a browser.

Kind: instance method of ProxyServer
Access: public

Param Type Default Description
browserName String browser name
url String the URL should be opened
[usePacProxy] Boolean false whether use PAC proxy

proxyServer.enableConfFile(confFileType, filePath) ⇒ ProxyServer

Enable specified configuration file.

Kind: instance method of ProxyServer
Access: public

Param Type Default Description
confFileType String file type (host/rewrite)
filePath String \ Array modified file path(s)

proxyServer.disableConfFile(confFileType, filePath) ⇒ ProxyServer

Disable specified configuration file.

Kind: instance method of ProxyServer
Access: public

Param Type Default Description
confFileType String file type (host/rewrite)
filePath String \ Array modified file path(s)