How to use the node-libcurl.Curl.proxy function in node-libcurl

To help you get started, we’ve selected a few node-libcurl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github do-web / curl-request / index.js View on Github external
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;
    };
github do-web / curl-request / index.js View on Github external
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;

node-libcurl

The fastest http(s) client (and much more) for Node.js - Node.js bindings for libcurl

MIT
Latest version published 9 months ago

Package Health Score

42 / 100
Full package analysis