vpndetection-next 2.2.6 → 2.2.7
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 +5 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install vpndetection-next
|
|
|
15
15
|
|
|
16
16
|
Requires Node.js 22 or newer and Next.js 15 or newer. The proxy runs on the Node.js runtime and, on Next 15, on the Edge runtime too.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Lookups need no API key to try: the free plan answers each address's first lookups of the day without one. A free API key answers your organization's first lookups each day with every field, and the basics with no cap. The Data plan answers every field on every lookup, the hosting, CDN and proxy flags and the provider behind each flag among them: create a key in the [console](https://app.vpndetection.io).
|
|
19
19
|
|
|
20
20
|
Next 16 renamed the file convention from `middleware.ts` to `proxy.ts`, and the export from `middleware` to `proxy`. Both work on 16, though `middleware.ts` logs a deprecation, so use whichever your version supports.
|
|
21
21
|
|
|
@@ -110,7 +110,7 @@ export const proxy = createProxy({
|
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
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. Any other agent, or none, is not sent, since its verdict could only be `not_bot`. One address is looked up with at most four crawler agents an hour: past those its lookup sends none, and a request passes as a crawler only where the answer's `bot.verified` is true. 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
|
|
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. Any other agent, or none, is not sent, since its verdict could only be `not_bot`. One address is looked up with at most four crawler agents an hour: past those its lookup sends none, and a request passes as a crawler only where the answer's `bot.verified` is true. 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 a free key's full answers: a served answer without one is reported once under `onMissingField`. The verdict is a paid member, so an app with no key gets no bot pass.
|
|
114
114
|
|
|
115
115
|
## Doing other work in the same proxy
|
|
116
116
|
|
|
@@ -186,7 +186,9 @@ Beyond a few million distinct visitors a day, stop calling the API per request:
|
|
|
186
186
|
|
|
187
187
|
## Absent is not false
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
The free plan's basics leave out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `is_bot`, `bot`, `user_agent`, `company` and `abuse`, and the AS's `type`, and of the detail behind each flag they answer 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".
|
|
190
|
+
|
|
191
|
+
`is_vpn` is absent from a free key's answer past your organization's full answers for the day, when `trial_expired` is true. `readLookup` then carries no `isVpn` and its `result` has no `is_vpn`, so a missing flag never reads as "not a VPN"; `lookup.result` on a `createGuard` answer reads `isVpn` as `false` there, which means "not in this answer". A `blockCondition` on `isVpn` against that answer is reported under `onMissingField` and never matches.
|
|
190
192
|
|
|
191
193
|
```ts
|
|
192
194
|
lookup.result?.is_hosting ?? false // when you only want the flag
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export declare const LOOKUP_HEADER = "x-vpndetection";
|
|
|
10
10
|
/** What `readLookup` gives back. The detail objects are carried through as served. */
|
|
11
11
|
export interface ForwardedLookup {
|
|
12
12
|
ip?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the address is VPN infrastructure, as the API said. Absent when the lookup failed, and when the API
|
|
15
|
+
* left it out: a free key's answer past its organization's full answers for the day, when `result.trial_expired`
|
|
16
|
+
* is true, so a missing flag never reads as "not a VPN".
|
|
17
|
+
*/
|
|
13
18
|
isVpn?: boolean;
|
|
14
19
|
blocked: boolean;
|
|
15
20
|
error?: string;
|
package/dist/index.js
CHANGED
|
@@ -142,7 +142,8 @@ function toForwarded(lookup) {
|
|
|
142
142
|
return {
|
|
143
143
|
...(lookup.ip === undefined ? {} : { ip: lookup.ip }),
|
|
144
144
|
...(lookup.result === undefined ? {} : {
|
|
145
|
-
|
|
145
|
+
// Only what the API sent: `Result` reads a missing `is_vpn` as false, which is no answer.
|
|
146
|
+
...('is_vpn' in lookup.result.raw ? { isVpn: lookup.result.isVpn } : {}),
|
|
146
147
|
result: lookup.result.raw,
|
|
147
148
|
}),
|
|
148
149
|
...(lookup.error === undefined ? {} : { error: lookup.error.kind }),
|
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;
|
|
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;AA+B9C;;;;;;;;;;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,CAAC,CAAC;QACtC,CAAC;QACD,OA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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.24.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"next": ">=15"
|