proxy-verifier
proxy-verifier copied to clipboard
How to return result?
Help me please! I newbie in js. I need to return result of your check but i can`t.
Tried 1:
let a = await ProxyVerifier.testProtocols(oneProxy, async function(error, result) {
return new Promise((resolve) => {
return resolve(result);
});
});
Tried 2:
let a = await ProxyVerifier.testProtocols(oneProxy, async function(error, result) {
return result;
});
Tried 3:
let/var/const a = null;
ProxyVerifier.testProtocols(oneProxy, async function(error, result) {
a = result;
});
Tried 4:
let a = {
proxy: ProxyVerifier.testProtocols(oneProxy, async function(error, result) {
this.value = result;
}),
value: null
}
Maybe answer is simple, but i can`t understand how get result.
The result is stored as a json in result for example you could call console.log(result); and get the full json output.
And would not recommend to do this in a let
this work for me
async checkProxyTunnel(itemProxy) {
return new Promise(function (resolve, reject) {
ProxyVerifier.testAll(itemProxy, function (error, result) {
resolve({ result, error })
})
})
}
and use:
await checkProxyTunnel(itemProxy)
where itemProxy is
itemProxy = {
ipAddress: '192.64.13.4'
port:8080
protocol:'https'
}