vpndetection-next 2.1.29 → 2.2.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/README.md +15 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -98,6 +98,20 @@ Replace the refusal with `onBlocked`. A redirect is usually friendlier than a 40
|
|
|
98
98
|
onBlocked: (request) => NextResponse.redirect(new URL('/no-vpn', request.url)),
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
## Let a verified crawler through
|
|
102
|
+
|
|
103
|
+
`allowBots` sends each request's own `User-Agent` with its lookup, and a request whose answer's `userAgent.verdict` is `verified`, a crawler its operator vouches for such as Googlebot from Google's addresses, is never blocked, whatever `blockCondition` matches. The answer is still forwarded, its `user_agent` included:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
export const proxy = createProxy({
|
|
107
|
+
apiKey: process.env.VPNDETECTION_API_KEY,
|
|
108
|
+
blockCondition: { isBot: true },
|
|
109
|
+
allowBots: true,
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A client claiming to be a crawler from an address its operator does not vouch for reads `spoofed`, so `blockCondition: { userAgent: { verdict: 'spoofed' } }` refuses a forged crawler. A request with no `User-Agent` sends none. It is off by default, and then no agent is sent and the cache keeps one answer per address rather than one per address and agent. A verdict needs a paid plan or the trial: a served answer without one is reported once under `onMissingField`.
|
|
114
|
+
|
|
101
115
|
## Doing other work in the same proxy
|
|
102
116
|
|
|
103
117
|
Most apps already have a proxy. Use `createGuard` and call it from yours:
|
|
@@ -172,7 +186,7 @@ Beyond a few million distinct visitors a day, stop calling the API per request:
|
|
|
172
186
|
|
|
173
187
|
## Absent is not false
|
|
174
188
|
|
|
175
|
-
Unlimited, with a key or without one, leaves out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `bot`, `company` and `abuse`, and of the detail behind each flag it answers only Tor's and relay's. A field your plan does not include is absent, which means "not in your plan" rather than "checked, and no".
|
|
189
|
+
Unlimited, with a key or without one, leaves out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `bot`, `user_agent`, `company` and `abuse`, and of the detail behind each flag it answers only Tor's and relay's. A field your plan does not include is absent, which means "not in your plan" rather than "checked, and no".
|
|
176
190
|
|
|
177
191
|
```ts
|
|
178
192
|
lookup.result?.is_hosting ?? false // when you only want the flag
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export function createProxy(options = {}) {
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export function createGuard(options = {}) {
|
|
46
|
-
const core = createCore(options, defaultIpSelector);
|
|
46
|
+
const core = createCore(options, defaultIpSelector, selectors.userAgentSelector);
|
|
47
47
|
const forwarding = options.forward !== false;
|
|
48
48
|
const guard = async (request) => core.evaluate(request);
|
|
49
49
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AA0B9C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,UAAmB,EAAE;IAC7C,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAE9C,OAAO,KAAK,UAAU,KAAK,CAAC,OAAoB;QAC5C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC,OAAO,EAAE,MAAM,CA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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QACrD,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;YAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAyC;SAClE,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACnE,OAAO,EAAE,MAAM,CAAC,OAAO;KAC1B,CAAC;AACN,CAAC;AAED,SAAS,MAAM;IACX,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vpndetection-next",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Official Next.js proxy/middleware for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN visitors on every request.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"node": ">=22"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"vpndetection": "^5.
|
|
47
|
+
"vpndetection": "^5.20.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"next": ">=15"
|