Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.setProxy = (host, proxyType) => {
this.curl.setOpt(Curl.option.PROXY, host);
// SOCKS5 default
if (typeof proxyType === 'undefined') {
this.curl.setOpt(Curl.option.PROXYTYPE, Curl.proxy.SOCKS5_HOSTNAME);
} else {
this.curl.setOpt(Curl.option.PROXYTYPE, proxyType);
}
return this;
};
module.exports = function () {
this['default'] = {
torControlHost: 'localhost',
torControlPort: 9051,
autoParse: true, // content-type detect -> json
verbose: false,
useProxy: false,
proxy: 'localhost:9050',
proxyType: Curl.proxy.SOCKS5_HOSTNAME
};
this.libcurl = Curl;
this.curl = new Curl();
this.newTorIdentity = () => {
let client = new Net.Socket();
client.connect(this['default'].torControlPort, this['default'].torControlHost, () => {
client.write('authenticate\nsignal newnym\nquit');
});
};
this._setUrl = (url) => {
this.curl.setOpt(Curl.option.URL, url);
return this;