vpndetection-express 2.0.40 → 2.1.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 CHANGED
@@ -67,6 +67,20 @@ app.use(vpndetection({
67
67
  }));
68
68
  ```
69
69
 
70
+ ## Let a verified crawler through
71
+
72
+ `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 on `req.vpndetection`:
73
+
74
+ ```js
75
+ app.use(vpndetection({
76
+ apiKey: process.env.VPNDETECTION_API_KEY,
77
+ blockCondition: { isBot: true },
78
+ allowBots: true,
79
+ }));
80
+ ```
81
+
82
+ 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`.
83
+
70
84
  ## Where the client address comes from
71
85
 
72
86
  Get this setting right, or none of the above works.
@@ -139,7 +153,7 @@ Beyond a few million distinct visitors a day, stop calling the API per request:
139
153
 
140
154
  ## Absent is not false
141
155
 
142
- 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 `undefined`, which means "not in your plan" rather than "checked, and no".
156
+ Unlimited, with a key or without one, leaves out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `bot`, `userAgent`, `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 `undefined`, which means "not in your plan" rather than "checked, and no".
143
157
 
144
158
  ```js
145
159
  req.vpndetection.result.isHosting ?? false // when you only want the flag
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { bindSelectors, createCore } from 'vpndetection/middleware';
11
11
  * `failClosed`.
12
12
  */
13
13
  export function vpndetection(options = {}) {
14
- const core = createCore(options, defaultIpSelector);
14
+ const core = createCore(options, defaultIpSelector, selectors.userAgentSelector);
15
15
  const onBlocked = options.onBlocked ?? refuse;
16
16
  return (req, res, next) => {
17
17
  core.evaluate(req).then((lookup) => {
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;AA2BpE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB,EAAE;IAC9C,MAAM,IAAI,GAAG,UAAU,CAAU,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAC9C,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACvD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YAC/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACvB,IAAI,EAAE,CAAC;gBACP,OAAO;YACX,CAAC;YACD,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC;YAC1B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;gBAC5B,OAAO;YACX,CAAC;YACD,IAAI,EAAE,CAAC;QACX,CAAC,EAAE,IAAI,CAAC,CAAC;IACb,CAAC,CAAC;AACN,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,CAAC;IAC5B,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACrB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAA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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpndetection-express",
3
- "version": "2.0.40",
3
+ "version": "2.1.0",
4
4
  "description": "Official Express 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.19.2"
47
+ "vpndetection": "^5.20.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "express": ">=4.18"