vpndetection-fastify 2.0.34 → 2.0.36

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.
Files changed (2) hide show
  1. package/README.md +7 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  [![npm](https://img.shields.io/npm/v/vpndetection-fastify.svg)](https://www.npmjs.com/package/vpndetection-fastify)
4
4
  [![license](https://img.shields.io/npm/l/vpndetection-fastify.svg)](LICENSE)
5
5
 
6
- The official [Fastify](https://fastify.dev) plugin for the [VPNDetection](https://vpndetection.io) API.
6
+ The official [Fastify](https://fastify.dev) plugin for the [VPNDetection](https://vpndetection.io) API: it checks each visitor's IP for VPN, Tor and proxy use, and can block them with a 403.
7
7
 
8
- It classifies the visitor behind each request — VPN, residential proxy, Tor, hosting, CDN, relay — and hands the answer to your handlers. Blocking is opt-in.
8
+ It classifies the visitor behind each request: VPN, residential proxy, Tor, hosting, CDN, relay. It hands the answer to your handlers. Blocking is opt-in.
9
9
 
10
10
  ## Getting Started
11
11
 
@@ -15,7 +15,7 @@ npm install vpndetection-fastify
15
15
 
16
16
  Requires Node.js 22 or newer and Fastify 4 or 5. TypeScript types are included.
17
17
 
18
- You need an API key on a paid plan. Create one in the [console](https://app.vpndetection.io); without one a lookup is on Unlimited, the free plan, and leaves out the hosting, CDN and proxy flags, so a paid plan is what makes this usable in production rather than optional. A free account tries every field, 100 lookups a day.
18
+ No API key needed to start. Without one, a lookup is on Unlimited, the free plan, which answers VPN, Tor and relay detection with no daily or monthly cap. A paid plan's key adds the hosting, CDN and proxy flags and the provider behind each flag: create one in the [console](https://app.vpndetection.io). A free account tries every field.
19
19
 
20
20
  ```js
21
21
  import Fastify from 'fastify';
@@ -35,7 +35,7 @@ app.get('/', async (request) => {
35
35
  await app.listen({ port: 3000 });
36
36
  ```
37
37
 
38
- By default nothing is blocked. Every request gets a `request.vpndetection` and your own code decides what that means — which is usually what you want, because whether a VPN visitor is a problem depends entirely on what they are doing.
38
+ By default nothing is blocked. Every request gets a `request.vpndetection` and your own code decides what to do with it, since whether a VPN visitor is a problem depends on what they're doing.
39
39
 
40
40
  ## Blocking
41
41
 
@@ -73,7 +73,7 @@ await app.register(vpndetection, {
73
73
 
74
74
  ## Where the client address comes from
75
75
 
76
- This is the setting that decides whether any of the above works, and it is the one thing only you can get right.
76
+ Get this setting right, or none of the above works.
77
77
 
78
78
  By default the plugin uses `request.ip`, which is Fastify's own accessor. **Fastify resolves `request.ip` to the socket peer unless you built the server with `trustProxy`.** So if your app sits behind nginx, a load balancer, or a CDN and you have not set it, every visitor arrives wearing your proxy's address, and that is the address that gets checked: VPN visitors pass unnoticed, and if it is a hosting address, a hosting rule blocks everyone. nginx on the same machine is `127.0.0.1` and a load balancer usually has a private address, which the plugin answers locally without a lookup, flagging nobody and logging a warning.
79
79
 
@@ -97,7 +97,7 @@ await app.register(vpndetection, {
97
97
  });
98
98
  ```
99
99
 
100
- `xffIpSelector()` reads `X-Forwarded-For` directly. Be aware that the left-most entry is whatever the caller sent, because proxies append to that header — it is only trustworthy when an edge you control overwrites it. If you know how many proxies sit in front, count from the right instead: `xffIpSelector({ depth: 1 })` is the address your nearest proxy saw.
100
+ `xffIpSelector()` reads `X-Forwarded-For` directly. The left-most entry is whatever the caller sent, since proxies append to that header, so trust it only when an edge you control overwrites it. If you know how many proxies sit in front, count from the right instead: `xffIpSelector({ depth: 1 })` is the address your nearest proxy saw.
101
101
 
102
102
  Anything else, pass your own function. It receives the Fastify request and returns an address:
103
103
 
@@ -125,7 +125,7 @@ Pass `failClosed: true` to block instead. Private addresses are answered locally
125
125
 
126
126
  ## Cost and latency
127
127
 
128
- Answers are cached per plugin registration for an hour, so a returning visitor costs nothing, and private addresses never leave the process. A cache miss is one request to our API, bounded at 2500 ms by default and not retried — on a request path, failing open quickly beats holding a visitor while we try again. Both are adjustable, along with the cache itself:
128
+ Answers are cached per plugin registration for an hour, so a returning visitor costs nothing, and private addresses never leave the process. A cache miss is one request to our API, bounded at 2500 ms by default and not retried: on a request path, failing open fast beats holding a visitor while we retry. Both are adjustable, along with the cache itself:
129
129
 
130
130
  ```js
131
131
  await app.register(vpndetection, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpndetection-fastify",
3
- "version": "2.0.34",
3
+ "version": "2.0.36",
4
4
  "description": "Official Fastify plugin for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN visitors on every request.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "fastify-plugin": "^5.0.1",
48
- "vpndetection": "^5.16.1"
48
+ "vpndetection": "^5.17.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "fastify": "4.x || 5.x"