@k03mad/dns-leak 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/api/cloud-ping.js +10 -10
- package/app/api/ip-leak.js +27 -27
- package/app/api/wander.js +3 -3
- package/app/helpers/spinner.js +1 -1
- package/package.json +3 -3
package/app/api/cloud-ping.js
CHANGED
|
@@ -26,29 +26,29 @@ export default class CloudPing {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @returns {Promise<
|
|
29
|
+
* @returns {Promise<object>}
|
|
30
30
|
*/
|
|
31
|
-
async
|
|
32
|
-
const
|
|
31
|
+
async getAllLocations() {
|
|
32
|
+
const locationsEndpoint = CloudPing.endpoints.locations();
|
|
33
33
|
|
|
34
|
-
const {
|
|
34
|
+
const {body} = await request(locationsEndpoint, {}, {
|
|
35
35
|
rps: this._requestsRps,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return body.nodes;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* @returns {Promise<
|
|
42
|
+
* @returns {Promise<string>}
|
|
43
43
|
*/
|
|
44
|
-
async
|
|
45
|
-
const
|
|
44
|
+
async getCurrentIataCode() {
|
|
45
|
+
const testEndpoint = CloudPing.endpoints.edge();
|
|
46
46
|
|
|
47
|
-
const {
|
|
47
|
+
const {headers} = await request(testEndpoint, {}, {
|
|
48
48
|
rps: this._requestsRps,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
return
|
|
51
|
+
return headers['x-amz-cf-pop'];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
package/app/api/ip-leak.js
CHANGED
|
@@ -37,14 +37,14 @@ export default class IPLeak {
|
|
|
37
37
|
static get endpoints() {
|
|
38
38
|
return {
|
|
39
39
|
|
|
40
|
-
/** @param {string} ip */
|
|
41
|
-
ip: ip => `https://ipleak.net/json/${ip}`,
|
|
42
|
-
|
|
43
40
|
/**
|
|
44
41
|
* @param {string} session
|
|
45
42
|
* @param {string} uniq
|
|
46
43
|
*/
|
|
47
44
|
dns: (session, uniq) => `https://${session}-${uniq}.ipleak.net/dnsdetection/`,
|
|
45
|
+
|
|
46
|
+
/** @param {string} ip */
|
|
47
|
+
ip: ip => `https://ipleak.net/json/${ip}`,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -60,18 +60,26 @@ export default class IPLeak {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {object} [opts]
|
|
63
|
-
* @param {string} [opts.
|
|
63
|
+
* @param {string} [opts.session]
|
|
64
|
+
* @param {boolean} [opts.isSpinnerEnabled]
|
|
64
65
|
* @returns {Promise<object>}
|
|
65
66
|
*/
|
|
66
|
-
async
|
|
67
|
-
const
|
|
67
|
+
async getDnsInfoMulti({isSpinnerEnabled, session = this._dnsSessionString} = {}) {
|
|
68
|
+
const spinnerName = 'DNS info';
|
|
69
|
+
const arrayFromLen = Array.from({length: this._dnsRequestsCount - 1});
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
expire: this._ipRequestsCacheExpireMs,
|
|
71
|
-
rps: this._requestsRps,
|
|
72
|
-
});
|
|
71
|
+
spinner.start(spinnerName, isSpinnerEnabled);
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
await Promise.all(arrayFromLen.map(async () => {
|
|
74
|
+
await this.getDnsInfoOnce({session});
|
|
75
|
+
spinner.count(spinnerName, this._dnsRequestsCount);
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
await sleep(this._dnsRequestsWaitBeforeLastMs);
|
|
79
|
+
const info = await this.getDnsInfoOnce({session});
|
|
80
|
+
|
|
81
|
+
spinner.stop(spinnerName);
|
|
82
|
+
return info;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
/**
|
|
@@ -93,26 +101,18 @@ export default class IPLeak {
|
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
103
|
* @param {object} [opts]
|
|
96
|
-
* @param {string} [opts.
|
|
97
|
-
* @param {boolean} [opts.isSpinnerEnabled]
|
|
104
|
+
* @param {string} [opts.ip]
|
|
98
105
|
* @returns {Promise<object>}
|
|
99
106
|
*/
|
|
100
|
-
async
|
|
101
|
-
const
|
|
102
|
-
const arrayFromLen = Array.from({length: this._dnsRequestsCount - 1});
|
|
103
|
-
|
|
104
|
-
spinner.start(spinnerName, isSpinnerEnabled);
|
|
105
|
-
|
|
106
|
-
await Promise.all(arrayFromLen.map(async () => {
|
|
107
|
-
await this.getDnsInfoOnce({session});
|
|
108
|
-
spinner.count(spinnerName, this._dnsRequestsCount);
|
|
109
|
-
}));
|
|
107
|
+
async getIpInfo({ip = ''} = {}) {
|
|
108
|
+
const ipEndpoint = IPLeak.endpoints.ip(ip);
|
|
110
109
|
|
|
111
|
-
await
|
|
112
|
-
|
|
110
|
+
const {body} = await requestCache(ipEndpoint, {}, {
|
|
111
|
+
expire: this._ipRequestsCacheExpireMs,
|
|
112
|
+
rps: this._requestsRps,
|
|
113
|
+
});
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
return info;
|
|
115
|
+
return body;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
}
|
package/app/api/wander.js
CHANGED
|
@@ -36,13 +36,13 @@ export default class Wander {
|
|
|
36
36
|
rps: this._requestsRps,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
return {
|
|
39
|
+
return {code: 0, color: red, name: 'OFF'};
|
|
40
40
|
} catch (err) {
|
|
41
41
|
if (err.code === 'ESERVFAIL') {
|
|
42
|
-
return {
|
|
42
|
+
return {code: 1, color: green, name: 'ON'};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return {
|
|
45
|
+
return {code: -1, color: yellow, name: 'unknown'};
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
package/app/helpers/spinner.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k03mad/dns-leak",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "DNS leak test",
|
|
5
5
|
"maintainers": [
|
|
6
6
|
"Kirill Molchanov <k03.mad@gmail.com"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@k03mad/request": "5.4.
|
|
22
|
+
"@k03mad/request": "5.4.1",
|
|
23
23
|
"chalk": "5.3.0",
|
|
24
24
|
"country-locale-map": "1.9.0",
|
|
25
25
|
"nanoid": "5.0.4",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ora": "8.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@k03mad/eslint-config": "
|
|
30
|
+
"@k03mad/eslint-config": "18.0.0",
|
|
31
31
|
"eslint": "8.56.0",
|
|
32
32
|
"husky": "8.0.3"
|
|
33
33
|
},
|