@k03mad/ip2geo 7.1.0 → 7.3.0
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/.husky/pre-commit +1 -2
- package/app/lib/ip2geo.js +26 -8
- package/package.json +8 -9
- package/tests/default.js +1 -1
- package/tests/shared/consts.js +5 -5
package/.husky/pre-commit
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
npm run test
|
|
1
|
+
./node_modules/.bin/run-p -c lint test
|
package/app/lib/ip2geo.js
CHANGED
|
@@ -67,7 +67,11 @@ export const ip2geo = async ({
|
|
|
67
67
|
rps = DEFAULT_RPS,
|
|
68
68
|
} = {}) => {
|
|
69
69
|
if (ip) {
|
|
70
|
-
const mapCache = readFromMapCache(
|
|
70
|
+
const mapCache = readFromMapCache(
|
|
71
|
+
ip,
|
|
72
|
+
cacheMap,
|
|
73
|
+
cacheMapMaxEntries,
|
|
74
|
+
);
|
|
71
75
|
|
|
72
76
|
if (mapCache) {
|
|
73
77
|
return mapCache;
|
|
@@ -75,12 +79,19 @@ export const ip2geo = async ({
|
|
|
75
79
|
|
|
76
80
|
const fsCache = await readFromFsCache(
|
|
77
81
|
ip,
|
|
78
|
-
cacheDir,
|
|
79
|
-
|
|
82
|
+
cacheDir,
|
|
83
|
+
cacheFileName,
|
|
84
|
+
cacheFileSeparator,
|
|
85
|
+
cacheFileNewline,
|
|
80
86
|
);
|
|
81
87
|
|
|
82
88
|
if (fsCache) {
|
|
83
|
-
writeToMapCache(
|
|
89
|
+
writeToMapCache(
|
|
90
|
+
fsCache,
|
|
91
|
+
cacheMap,
|
|
92
|
+
cacheMapMaxEntries,
|
|
93
|
+
);
|
|
94
|
+
|
|
84
95
|
return fsCache;
|
|
85
96
|
}
|
|
86
97
|
}
|
|
@@ -112,12 +123,19 @@ export const ip2geo = async ({
|
|
|
112
123
|
body?.connection?.domain,
|
|
113
124
|
]);
|
|
114
125
|
|
|
115
|
-
writeToMapCache(
|
|
126
|
+
writeToMapCache(
|
|
127
|
+
outputData,
|
|
128
|
+
cacheMap,
|
|
129
|
+
cacheMapMaxEntries,
|
|
130
|
+
);
|
|
116
131
|
|
|
117
132
|
await writeToFsCache(
|
|
118
|
-
body.ip,
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
body.ip,
|
|
134
|
+
outputData,
|
|
135
|
+
cacheDir,
|
|
136
|
+
cacheFileName,
|
|
137
|
+
cacheFileSeparator,
|
|
138
|
+
cacheFileNewline,
|
|
121
139
|
);
|
|
122
140
|
|
|
123
141
|
return outputData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k03mad/ip2geo",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "GeoIP library",
|
|
5
5
|
"maintainers": [
|
|
6
6
|
"Kirill Molchanov <k03.mad@gmail.com"
|
|
@@ -19,24 +19,23 @@
|
|
|
19
19
|
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@k03mad/request": "5.
|
|
23
|
-
"@k03mad/simple-log": "2.1
|
|
22
|
+
"@k03mad/request": "5.8.1",
|
|
23
|
+
"@k03mad/simple-log": "2.2.1",
|
|
24
24
|
"chalk": "5.3.0",
|
|
25
|
-
"debug": "4.3.
|
|
25
|
+
"debug": "4.3.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@k03mad/eslint-config": "
|
|
28
|
+
"@k03mad/eslint-config": "22.4.0",
|
|
29
29
|
"eslint": "8.57.0",
|
|
30
30
|
"husky": "9.0.11",
|
|
31
|
-
"mocha": "10.4.0"
|
|
31
|
+
"mocha": "10.4.0",
|
|
32
|
+
"npm-run-all": "4.1.5"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"lint": "npm run lint:eslint",
|
|
35
36
|
"lint:eslint": "eslint ./ --cache",
|
|
36
37
|
"test": "rm -rfv ./.geoip && mocha tests",
|
|
37
|
-
"clean": "
|
|
38
|
-
"clean:modules": "rm -rf ./node_modules || true",
|
|
39
|
-
"clean:eslint:cache": "rm -rf .eslintcache || true",
|
|
38
|
+
"clean": "rm -rf ./node_modules .eslintcache || true",
|
|
40
39
|
"setup": "npm run clean && npm run setup:pnpm",
|
|
41
40
|
"setup:pnpm": "npm i pnpm -g && pnpm i",
|
|
42
41
|
"prepare": "husky || true"
|
package/tests/default.js
CHANGED
package/tests/shared/consts.js
CHANGED
|
@@ -25,8 +25,8 @@ export const REQUEST_IPV4_MAP_OFF_ONLY = {
|
|
|
25
25
|
regionCode: 'ZH',
|
|
26
26
|
city: 'Zürich',
|
|
27
27
|
connectionAsn: 19_281,
|
|
28
|
-
connectionOrg: '
|
|
29
|
-
connectionIsp: '
|
|
28
|
+
connectionOrg: 'Quad',
|
|
29
|
+
connectionIsp: 'Quad',
|
|
30
30
|
connectionDomain: 'quad9.net',
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -40,8 +40,8 @@ export const REQUEST_IPV6 = {
|
|
|
40
40
|
region: 'North Holland',
|
|
41
41
|
regionCode: 'NH',
|
|
42
42
|
city: 'Amsterdam',
|
|
43
|
-
connectionAsn:
|
|
44
|
-
connectionOrg: '',
|
|
45
|
-
connectionIsp: '
|
|
43
|
+
connectionAsn: 36_236,
|
|
44
|
+
connectionOrg: 'Netactuate INC',
|
|
45
|
+
connectionIsp: 'Netactuate, INC',
|
|
46
46
|
connectionDomain: '',
|
|
47
47
|
};
|