nodejs-proxy-checkerv2
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -19,4 +19,5 @@ import ProxyAnonymousLevel from "../enum/ProxyAnonymousLevel"; | ||
axios: AxiosStatic | null; | ||
timeout: number; | ||
constructor(proxy: string, axios: AxiosStatic); | ||
checkProxy(proxyJudgeSelected: string, proxyInformationProviderSelected: string, myIP: string): Promise<void>; | ||
checkProxy(proxyJudgeSelected: string, proxyInformationProviderSelected: string, myIP: string, timeout?: number): Promise<void>; | ||
private setAnonymousInformation; | ||
@@ -23,0 +24,0 @@ private getProxyInformation; |
@@ -31,2 +31,3 @@ "use strict"; | ||
this.axios = null; | ||
this.timeout = 0; | ||
this.proxy = proxy; | ||
@@ -37,6 +38,7 @@ this.axios = axios; | ||
} | ||
checkProxy(proxyJudgeSelected, proxyInformationProviderSelected, myIP) { | ||
checkProxy(proxyJudgeSelected, proxyInformationProviderSelected, myIP, timeout = 0) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.proxyJudgeSelected = proxyJudgeSelected; | ||
this.proxyInformationProviderSelected = proxyInformationProviderSelected; | ||
this.timeout = timeout; | ||
let data; | ||
@@ -128,2 +130,3 @@ try { | ||
return yield this.axios.get(url, { | ||
timeout: this.timeout, | ||
proxy: { | ||
@@ -130,0 +133,0 @@ host: this.address, |
@@ -10,2 +10,3 @@ import Proxy from "./classes/Proxy"; | ||
myIP: string; | ||
timeout: number; | ||
addProxiesFromFile(path: string): this; | ||
@@ -18,2 +19,7 @@ addProxiesFromArray(proxies: string[]): this; | ||
addDefaultProxyInformationProvider(): this; | ||
/** | ||
* | ||
* @param msTimeout Number of millisecond | ||
*/ | ||
setRequestTimeout(msTimeout: number): this; | ||
private addProxyInList; | ||
@@ -20,0 +26,0 @@ /** |
@@ -33,2 +33,3 @@ "use strict"; | ||
this.myIP = ""; | ||
this.timeout = 0; | ||
} | ||
@@ -69,2 +70,10 @@ addProxiesFromFile(path) { | ||
} | ||
/** | ||
* | ||
* @param msTimeout Number of millisecond | ||
*/ | ||
setRequestTimeout(msTimeout) { | ||
this.timeout = msTimeout; | ||
return this; | ||
} | ||
addProxyInList(proxy) { | ||
@@ -90,3 +99,3 @@ this.proxiesList.push(new Proxy_1.default(proxy, axios_1.default)); | ||
result = yield Promise.all(this.proxiesList.map((proxy) => __awaiter(this, void 0, void 0, function* () { | ||
yield proxy.checkProxy(this.getRandomProxyJudge(), this.getRandomProxyInformationProvider(), this.myIP); | ||
yield proxy.checkProxy(this.getRandomProxyJudge(), this.getRandomProxyInformationProvider(), this.myIP, this.timeout); | ||
var r = new Result_1.default(proxy.anonymousLevel, proxy.speedLevel, proxy.status, proxy.version, proxy.proxy, proxy.proxyJudgeSelected, proxy.timeTaken, proxy.proxyInformationProviderSelected, proxy.country); | ||
@@ -93,0 +102,0 @@ if (callback) |
{ | ||
"name": "nodejs-proxy-checkerv2", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "It's simple Proxy Checker, get proxy status, anonymous level, type, time, country", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -28,2 +28,4 @@ # NodeJS-Proxy-CheckerV2 | ||
Proxy format: <strong>address:port</strong> or <strong>address:port:username:password</strong> | ||
### Load proxies with file | ||
@@ -63,4 +65,2 @@ | ||
Format: address: port | ||
```javascript | ||
@@ -67,0 +67,0 @@ const instance =new ProxyChecker() |
1
23111
21
452