mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [proxy-verifier] Add types for proxy-verifier * Add minimum TS version These definitions depends on request, which has a minimum TS version of 2.3 * Refactor static class and namespace to plain ES6 exports
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import * as ProxyVerifier from "proxy-verifier";
|
|
|
|
const proxy: ProxyVerifier.Proxy = {
|
|
ipAddress: "123.123.123.123",
|
|
port: 8080,
|
|
auth: "test",
|
|
protocol: "socks5",
|
|
protocols: [ "socks5", "https" ]
|
|
};
|
|
|
|
const requestOptions = {
|
|
method: "GET"
|
|
};
|
|
|
|
const testOptions = {
|
|
testUrl: "www.example.com",
|
|
testFn: (data: string, status: number, headers: ProxyVerifier.Headers) => {}
|
|
};
|
|
|
|
function cb(error: any, result: string | ProxyVerifier.Result | ProxyVerifier.ProtocolResult | ProxyVerifier.CustomTestResult | ProxyVerifier.AllResults) {
|
|
if (error) console.error(error);
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
ProxyVerifier.testAll(proxy, requestOptions, cb);
|
|
ProxyVerifier.testAll(proxy, requestOptions, cb);
|
|
|
|
ProxyVerifier.testProtocol(proxy, requestOptions, cb);
|
|
ProxyVerifier.testProtocol(proxy, requestOptions, cb);
|
|
|
|
ProxyVerifier.testProtocols(proxy, requestOptions, cb);
|
|
ProxyVerifier.testProtocols(proxy, requestOptions, cb);
|
|
|
|
ProxyVerifier.testAnonymityLevel(proxy, requestOptions, cb);
|
|
ProxyVerifier.testAnonymityLevel(proxy, requestOptions, cb);
|
|
|
|
ProxyVerifier.testTunnel(proxy, requestOptions, cb);
|
|
ProxyVerifier.testTunnel(proxy, requestOptions, cb);
|
|
|
|
ProxyVerifier.test(proxy, testOptions, cb);
|
|
ProxyVerifier.test(proxy, testOptions, cb);
|