vpndetection-fastify 1.0.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/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mslm Dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# [<img src="https://s3.vpndetection.io/vpndetection-public/brand/mark.svg" alt="VPNDetection" width="24"/>](https://vpndetection.io/) VPNDetection Fastify Plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/vpndetection-fastify)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
The official [Fastify](https://fastify.dev) plugin for the [VPNDetection](https://vpndetection.io) API.
|
|
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.
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install vpndetection-fastify
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requires Node.js 22 or newer and Fastify 4 or 5. TypeScript types are included.
|
|
17
|
+
|
|
18
|
+
You need an API key. Create one in the [console](https://app.vpndetection.io); the free tier's allowance is counted per source address, and a server is a single source address, so a key is what makes this usable in production rather than optional.
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import Fastify from 'fastify';
|
|
22
|
+
import { vpndetection } from 'vpndetection-fastify';
|
|
23
|
+
|
|
24
|
+
// trustProxy tells Fastify to believe X-Forwarded-For; see "Where the client
|
|
25
|
+
// address comes from" below.
|
|
26
|
+
const app = Fastify({ trustProxy: true });
|
|
27
|
+
|
|
28
|
+
await app.register(vpndetection, { apiKey: process.env.VPNDETECTION_API_KEY });
|
|
29
|
+
|
|
30
|
+
app.get('/', async (request) => {
|
|
31
|
+
const { result } = request.vpndetection;
|
|
32
|
+
return result.isVpn ? 'Hello, VPN user' : 'Hello';
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
await app.listen({ port: 3000 });
|
|
36
|
+
```
|
|
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.
|
|
39
|
+
|
|
40
|
+
## Blocking
|
|
41
|
+
|
|
42
|
+
Pass a `blockCondition` and a matching request is answered with `403` and never reaches your handlers.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
await app.register(vpndetection, {
|
|
46
|
+
apiKey: process.env.VPNDETECTION_API_KEY,
|
|
47
|
+
blockCondition: { isVpn: true },
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A condition is written in the shape of a result, and only the members you name are considered. That lets it reach the evidence, not just the flags:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
blockCondition: { isVpn: true, vpn: { provider: 'nordvpn' } } // one provider
|
|
55
|
+
blockCondition: { isResproxy: true, resproxy: { hits: { gte: 5 } } } // a numeric threshold
|
|
56
|
+
blockCondition: { vpn: { confidence: ['high', 'medium'] } } // any of these
|
|
57
|
+
blockCondition: [{ isTor: true }, { isResproxy: true }] // a list is OR
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Values are matched by equality, strings without regard to case. An array means any-of. `{ gte, gt, lte, lt }` compares numbers, and every bound you give must hold, so two of them are a range. Members you set to `false` or `null` are ignored, so a condition states the signals you act on; one that constrains nothing would match every request, and is refused when the middleware is created rather than silently blocking all your traffic.
|
|
61
|
+
|
|
62
|
+
Replace the refusal with `onBlocked`:
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
await app.register(vpndetection, {
|
|
66
|
+
apiKey: process.env.VPNDETECTION_API_KEY,
|
|
67
|
+
blockCondition: { isVpn: true },
|
|
68
|
+
onBlocked: (request, reply) => reply.status(403).send({ error: 'VPN not allowed' }),
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`onBlocked` may be async; it is awaited, so the route handler never runs.
|
|
73
|
+
|
|
74
|
+
## Where the client address comes from
|
|
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.
|
|
77
|
+
|
|
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 — which is a datacenter address, so a hosting rule would block all of them.
|
|
79
|
+
|
|
80
|
+
If you are behind a proxy you control, setting Fastify's own option is the right fix and everything else here follows from it:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const app = Fastify({ trustProxy: true });
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For an edge that writes the address into its own header, name the header:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import { headerIpSelector } from 'vpndetection-fastify';
|
|
90
|
+
|
|
91
|
+
await app.register(vpndetection, {
|
|
92
|
+
apiKey: process.env.VPNDETECTION_API_KEY,
|
|
93
|
+
ipSelector: headerIpSelector('CF-Connecting-IP'), // or True-Client-IP, or your own
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`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.
|
|
98
|
+
|
|
99
|
+
Anything else, pass your own function. It receives the Fastify request and returns an address:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
ipSelector: (request) => request.headers['x-real-ip'] ?? request.ip,
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If the address resolves to a private one, the middleware says so once on `console.warn`. That is expected on localhost and is the signal to fix your configuration anywhere else.
|
|
106
|
+
|
|
107
|
+
## When a lookup fails
|
|
108
|
+
|
|
109
|
+
The request is let through, and the reason is recorded on `request.vpndetection.error`. Our outage should not become yours, so a network failure, an exhausted quota or a rejected key all fail open.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
app.get('/', async (request) => {
|
|
113
|
+
const { result, error } = request.vpndetection;
|
|
114
|
+
if (error) {
|
|
115
|
+
request.log.warn({ kind: error.kind }, 'vpndetection unavailable');
|
|
116
|
+
}
|
|
117
|
+
return result?.isVpn ? 'Hello, VPN user' : 'Hello';
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Pass `failClosed: true` to block instead. Private addresses are answered locally and never fail, so this will not lock you out in development.
|
|
122
|
+
|
|
123
|
+
## Cost and latency
|
|
124
|
+
|
|
125
|
+
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:
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
await app.register(vpndetection, {
|
|
129
|
+
apiKey: KEY, timeoutMs: 1000, retries: 1, cache: { max: 50000, ttlMs: 600000 },
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Register it inside a scope to confine it to those routes, or skip what you do not care about:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
await app.register(async (scope) => {
|
|
137
|
+
await scope.register(vpndetection, { apiKey: KEY });
|
|
138
|
+
scope.get('/checkout', handler);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
await app.register(vpndetection, {
|
|
142
|
+
apiKey: KEY, skip: (request) => request.url.startsWith('/static'),
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If you already hold a `VPNDetection` client, pass it as `client` and the plugin will share it rather than building a second cache.
|
|
147
|
+
|
|
148
|
+
Beyond a few million distinct visitors a day, stop calling the API per request: [download the dataset](https://vpndetection.io/databases) and look addresses up locally instead.
|
|
149
|
+
|
|
150
|
+
## Absent is not false
|
|
151
|
+
|
|
152
|
+
Only `ip` and `isVpn` come back on every plan. A field your plan does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
request.vpndetection.result.isHosting ?? false // when you only want the flag
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
A `blockCondition` naming a member your plan does not serve can never match, so the plugin warns once instead of failing silently. Set `onMissingField: 'throw'` to make it an error.
|
|
159
|
+
|
|
160
|
+
## Other Libraries
|
|
161
|
+
|
|
162
|
+
There are official VPNDetection client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/vpndetection-io for more.
|
|
163
|
+
|
|
164
|
+
## About VPNDetection
|
|
165
|
+
|
|
166
|
+
VPN Detection API: Accurate anonymity detection identifying VPNs, residential proxies, hosting servers, Tor nodes, CDNs, relays and more.
|
|
167
|
+
|
|
168
|
+
[<img src="https://s3.vpndetection.io/vpndetection-public/brand/mark.svg" alt="VPNDetection" width="96"/>](https://vpndetection.io/)
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
This project is licensed under the [MIT License](LICENSE).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IpSelector, Lookup, MiddlewareOptions } from 'vpndetection/middleware';
|
|
2
|
+
import type { FastifyPluginAsync, FastifyReply, FastifyRequest } from 'fastify';
|
|
3
|
+
export type { BlockCondition, IpSelector, Lookup, NumericBound } from 'vpndetection/middleware';
|
|
4
|
+
declare module 'fastify' {
|
|
5
|
+
interface FastifyRequest {
|
|
6
|
+
/**
|
|
7
|
+
* What the plugin found out about this visitor. Absent when the plugin
|
|
8
|
+
* has not run for this route, or when `skip` claimed it.
|
|
9
|
+
*/
|
|
10
|
+
vpndetection?: Lookup;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface Options extends MiddlewareOptions<FastifyRequest> {
|
|
14
|
+
/**
|
|
15
|
+
* How a blocked request is answered. Defaults to `403` with a short JSON
|
|
16
|
+
* body. Whatever you pass must send a reply.
|
|
17
|
+
*/
|
|
18
|
+
onBlocked?: (request: FastifyRequest, reply: FastifyReply, lookup: Lookup) => unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Classify the visitor and hang the answer off `request.vpndetection`.
|
|
22
|
+
*
|
|
23
|
+
* Without a `blockCondition` this only enriches the request and never refuses
|
|
24
|
+
* one, leaving the decision to your own handlers. With one, a matching request
|
|
25
|
+
* is answered by `onBlocked` and never reaches them.
|
|
26
|
+
*
|
|
27
|
+
* A lookup that fails - network, quota, an outage of ours - lets the request
|
|
28
|
+
* through and records why on `request.vpndetection.error`, unless you set
|
|
29
|
+
* `failClosed`.
|
|
30
|
+
*
|
|
31
|
+
* Registered through `fastify-plugin`, so the decorator and the hook apply to
|
|
32
|
+
* the instance you register it on rather than to a child Fastify would
|
|
33
|
+
* otherwise create. Register it inside a scope to confine it to those routes.
|
|
34
|
+
*/
|
|
35
|
+
export declare const vpndetection: FastifyPluginAsync<Options>;
|
|
36
|
+
/**
|
|
37
|
+
* `request.ip`, which is the socket peer unless you built the server with
|
|
38
|
+
* `trustProxy`. Behind a load balancer without it, every visitor looks like the
|
|
39
|
+
* load balancer - so if you are behind one, set it or pick another selector.
|
|
40
|
+
*/
|
|
41
|
+
export declare const defaultIpSelector: IpSelector<FastifyRequest>;
|
|
42
|
+
/**
|
|
43
|
+
* An address from `X-Forwarded-For`.
|
|
44
|
+
*
|
|
45
|
+
* **The left-most entry is whatever the caller sent**, since proxies append, so
|
|
46
|
+
* this is only trustworthy when an edge you control overwrites the header. When
|
|
47
|
+
* you know how many proxies sit in front, count from the right instead:
|
|
48
|
+
* `xffIpSelector({ depth: 1 })` is the address your nearest proxy saw.
|
|
49
|
+
*/
|
|
50
|
+
export declare const xffIpSelector: (options?: {
|
|
51
|
+
depth?: number;
|
|
52
|
+
}) => IpSelector<FastifyRequest>;
|
|
53
|
+
/**
|
|
54
|
+
* An address from a single-value header your edge writes -
|
|
55
|
+
* `headerIpSelector('CF-Connecting-IP')` behind Cloudflare,
|
|
56
|
+
* `headerIpSelector('True-Client-IP')` behind Akamai. Falls back to
|
|
57
|
+
* `request.ip` when the header is absent.
|
|
58
|
+
*/
|
|
59
|
+
export declare const headerIpSelector: (name: string) => IpSelector<FastifyRequest>;
|
|
60
|
+
export default vpndetection;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { bindSelectors, createCore } from 'vpndetection/middleware';
|
|
2
|
+
import fp from 'fastify-plugin';
|
|
3
|
+
/**
|
|
4
|
+
* Classify the visitor and hang the answer off `request.vpndetection`.
|
|
5
|
+
*
|
|
6
|
+
* Without a `blockCondition` this only enriches the request and never refuses
|
|
7
|
+
* one, leaving the decision to your own handlers. With one, a matching request
|
|
8
|
+
* is answered by `onBlocked` and never reaches them.
|
|
9
|
+
*
|
|
10
|
+
* A lookup that fails - network, quota, an outage of ours - lets the request
|
|
11
|
+
* through and records why on `request.vpndetection.error`, unless you set
|
|
12
|
+
* `failClosed`.
|
|
13
|
+
*
|
|
14
|
+
* Registered through `fastify-plugin`, so the decorator and the hook apply to
|
|
15
|
+
* the instance you register it on rather than to a child Fastify would
|
|
16
|
+
* otherwise create. Register it inside a scope to confine it to those routes.
|
|
17
|
+
*/
|
|
18
|
+
export const vpndetection = fp(async (fastify, options) => {
|
|
19
|
+
const core = createCore(options, defaultIpSelector);
|
|
20
|
+
const onBlocked = options.onBlocked ?? refuse;
|
|
21
|
+
// Decorated up front so the property exists on every request object
|
|
22
|
+
// rather than being added per request, which deoptimizes the shape
|
|
23
|
+
// Fastify builds for them.
|
|
24
|
+
fastify.decorateRequest('vpndetection', undefined);
|
|
25
|
+
fastify.addHook('onRequest', async (request, reply) => {
|
|
26
|
+
const lookup = await core.evaluate(request);
|
|
27
|
+
if (lookup === undefined) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
request.vpndetection = lookup;
|
|
31
|
+
if (lookup.blocked) {
|
|
32
|
+
// Returned, not just called: a `reply.send()` already ends the
|
|
33
|
+
// lifecycle, but an ASYNC onBlocked has not sent anything yet
|
|
34
|
+
// when the hook resolves, so without awaiting it the handler
|
|
35
|
+
// runs and answers the request it was meant to refuse.
|
|
36
|
+
return await onBlocked(request, reply, lookup);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}, { name: 'vpndetection', fastify: '4.x || 5.x' });
|
|
40
|
+
const view = (request) => ({
|
|
41
|
+
header: (name) => {
|
|
42
|
+
const value = request.headers[name.toLowerCase()];
|
|
43
|
+
return Array.isArray(value) ? value[0] : value;
|
|
44
|
+
},
|
|
45
|
+
frameworkIp: () => request.ip,
|
|
46
|
+
});
|
|
47
|
+
// Each of these is annotated rather than inferred: the inferred shape reaches
|
|
48
|
+
// through `fastify`'s own types into its transitive ones, which TypeScript
|
|
49
|
+
// refuses to name in a declaration file a consumer would have to resolve.
|
|
50
|
+
const selectors = bindSelectors(view);
|
|
51
|
+
/**
|
|
52
|
+
* `request.ip`, which is the socket peer unless you built the server with
|
|
53
|
+
* `trustProxy`. Behind a load balancer without it, every visitor looks like the
|
|
54
|
+
* load balancer - so if you are behind one, set it or pick another selector.
|
|
55
|
+
*/
|
|
56
|
+
export const defaultIpSelector = selectors.defaultIpSelector;
|
|
57
|
+
/**
|
|
58
|
+
* An address from `X-Forwarded-For`.
|
|
59
|
+
*
|
|
60
|
+
* **The left-most entry is whatever the caller sent**, since proxies append, so
|
|
61
|
+
* this is only trustworthy when an edge you control overwrites the header. When
|
|
62
|
+
* you know how many proxies sit in front, count from the right instead:
|
|
63
|
+
* `xffIpSelector({ depth: 1 })` is the address your nearest proxy saw.
|
|
64
|
+
*/
|
|
65
|
+
export const xffIpSelector = selectors.xffIpSelector;
|
|
66
|
+
/**
|
|
67
|
+
* An address from a single-value header your edge writes -
|
|
68
|
+
* `headerIpSelector('CF-Connecting-IP')` behind Cloudflare,
|
|
69
|
+
* `headerIpSelector('True-Client-IP')` behind Akamai. Falls back to
|
|
70
|
+
* `request.ip` when the header is absent.
|
|
71
|
+
*/
|
|
72
|
+
export const headerIpSelector = selectors.headerIpSelector;
|
|
73
|
+
function refuse(_request, reply) {
|
|
74
|
+
return reply.status(403).send({ error: 'access denied' });
|
|
75
|
+
}
|
|
76
|
+
export default vpndetection;
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIpE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAsBhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgC,EAAE,CACvD,KAAK,EAAE,OAAwB,EAAE,OAAgB,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,UAAU,CAAiB,OAAO,EAAE,iBAAiB,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAE9C,oEAAoE;IACpE,mEAAmE;IACnE,2BAA2B;IAC3B,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAEnD,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,OAAuB,EAAE,KAAmB,EAAE,EAAE;QAChF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO;QACX,CAAC;QACD,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;QAC9B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,+DAA+D;YAC/D,8DAA8D;YAC9D,6DAA6D;YAC7D,uDAAuD;YACvD,OAAO,MAAM,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,EACD,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,CAClD,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,OAAuB,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACrB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAClD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACnD,CAAC;IACD,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE;CAChC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,SAAS,GAAG,aAAa,CAAiB,IAAI,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+B,SAAS,CAAC,iBAAiB,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACpB,SAAS,CAAC,aAAa,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GACvB,SAAS,CAAC,gBAAgB,CAAC;AAEjC,SAAS,MAAM,CAAC,QAAwB,EAAE,KAAmB;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vpndetection-fastify",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official Fastify plugin for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN visitors on every request.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://vpndetection.io",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/vpndetection-io/sdk-nodejs-fastify.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/vpndetection-io/sdk-nodejs-fastify/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"fastify",
|
|
17
|
+
"fastify-plugin",
|
|
18
|
+
"middleware",
|
|
19
|
+
"vpn",
|
|
20
|
+
"vpn-detection",
|
|
21
|
+
"proxy-detection",
|
|
22
|
+
"tor",
|
|
23
|
+
"ip-intelligence",
|
|
24
|
+
"fraud-prevention",
|
|
25
|
+
"bot-detection",
|
|
26
|
+
"residential-proxy",
|
|
27
|
+
"hosting"
|
|
28
|
+
],
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"fastify-plugin": "^5.0.1",
|
|
48
|
+
"vpndetection": "^1.8.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"fastify": "4.x || 5.x"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^26.2.0",
|
|
55
|
+
"fastify": "^5.6.1",
|
|
56
|
+
"typescript": "^5.9.3"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rm -rf dist && tsc",
|
|
60
|
+
"test": "pnpm run build && node --test test/*.test.mjs"
|
|
61
|
+
}
|
|
62
|
+
}
|