256cats / check-proxy

Advanced Node proxy checker (node proxy verifier, node proxy tester) with socks and https support
https://www.npmjs.com/package/check-proxy
MIT License
107 stars 40 forks source link

proxy checked, invalid #9

Closed ghost closed 5 years ago

ghost commented 5 years ago

check-proxy is not working on my device i tested multiple valid proxies(http(s)/socks) but it always prints: proxy checked, invalid


//client.js
const checkProxy = require('check-proxy').check;
checkProxy({
    testHost: 'ping.rhcloud.com', // put your ping server url here
    proxyIP: '127.0.0.1', // proxy ip to test
    proxyPort: 44443, // proxy port to test
    localIP: '104.237.226.134', // local machine IP address to test
    connectTimeout: 15, // curl connect timeout, sec
    timeout: 10, // curl timeout, sec
    websites: [
        {
            name: 'example',
            url: 'http://www.example.com/',
            regex: /example/gim, // expected result - regex

        },
        {
            name: 'yandex',
            url: 'http://www.yandex.ru/',
            regex: /yandex/gim, // expected result - regex

        },
        {
            name: 'google',
            url: 'http://www.google.com/',
            regex: function(html) { // expected result - custom function
                return html && html.indexOf('google') != -1;
            },
        },
        {
            name: 'amazon',
            url: 'http://www.amazon.com/',
            regex: 'Amazon', // expected result - look for this string in the output
        },

    ]
}).then(function(res) {
    console.log('final result', res);
}, function(err) {
    console.log('proxy rejected', err);
});
ChakshuGautam commented 5 years ago

Getting the same result. @mehhrad Did you find a solution?

ChakshuGautam commented 5 years ago

I had an extra slash in my server url. Fixing that fixed everything. This error is mostly if your server (server.js in the example) is not working properly.

fdterr commented 5 years ago

Also getting the same issue, no extra slashes in my server URL

ChakshuGautam commented 5 years ago

Any server error is thrown as the proxy checked, invalid even if all the other things are running fine. Also if the proxy is not working, it gives the same error.

256cats commented 5 years ago

error is thrown as the proxy checked, invalid even if all the other things are running fine. Also if the proxy is not working, it gives the same error.

Exactly. Any error will throw proxy checked, invalid exception.