I have a script that requests a given URL via a proxy. A failure to connect to the proxy gives an identical error to a failure to connect to the URL over a successful proxy connection.
This code:
var opts = url.parse("https://192.168.0.10/");//this ip address doesn't resolve anywhere
opts.agent = new SocksProxyAgent("socks4://works.local:1080");//this proxy works
https.get(opts, function (resp) {
//successful request is dealt with
}).on("error", function (err) {console.log(err)});
Produces this output:
SocksClientError: Proxy connection timed out
#I cutout the stack trace for brevity
options: {
proxy: { host: 'works.local', port: 1080, type: 4 },
destination: { host: '192.168.0.10', port: 443 },
command: 'connect',
timeout: undefined
}
If I run the same code but instead with a working URL, and a deliberately non-resolving proxy, I get an identical error message.
Is there a convenient way of being more specific about what is broken, whether a failure to connect to the proxy, or a failure to connect to the target URL?