guardian-risk-vpn 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Guardian Contributors
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,49 @@
1
+ # guardian-risk-vpn
2
+
3
+ > **Requires:** [`guardian-risk`](https://www.npmjs.com/package/guardian-risk) (core)
4
+
5
+ ```bash
6
+ npm install guardian-risk guardian-risk-vpn
7
+ ```
8
+
9
+ > **Stub package** — API may change before `1.0.0`.
10
+
11
+ VPN, proxy, and Tor detection for [guardian-risk](https://www.npmjs.com/package/guardian-risk). Resolves client IP and adds network risk signals.
12
+
13
+ ## Planned signals
14
+
15
+ | Signal | Description |
16
+ |--------|-------------|
17
+ | `vpn` | VPN exit node detected |
18
+ | `proxy` | Public proxy detected |
19
+ | `tor` | Tor exit node detected |
20
+ | `country` | ISO country code from IP |
21
+ | `asn` | Autonomous system number |
22
+
23
+ ## Usage (stub)
24
+
25
+ ```typescript
26
+ import { Guardian } from 'guardian-risk';
27
+ import { vpnPlugin, checkIp } from 'guardian-risk-vpn';
28
+
29
+ const guardian = new Guardian().use(
30
+ vpnPlugin({ provider: 'maxmind', vpnScore: 20, registerDefaultRules: true }),
31
+ );
32
+
33
+ await checkIp('203.0.113.10', guardian);
34
+ const report = guardian.analyze();
35
+ ```
36
+
37
+ ## Default rules (optional)
38
+
39
+ When `registerDefaultRules: true`, the plugin registers:
40
+
41
+ | Rule | Condition | Default score |
42
+ |------|-----------|---------------|
43
+ | VpnDetected | `vpn === true` | `vpnScore` (20) |
44
+ | ProxyDetected | `proxy === true` | `vpnScore` (20) |
45
+ | TorDetected | `tor === true` | `vpnScore + 10` (30) |
46
+
47
+ ## Status
48
+
49
+ Not yet published. Implementation in progress.
package/dist/index.cjs ADDED
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ // src/index.ts
4
+ function vpnPlugin(options = {}) {
5
+ const {
6
+ provider = "maxmind",
7
+ vpnScore = 20,
8
+ registerDefaultRules = true
9
+ } = options;
10
+ return {
11
+ name: "guardian-risk-vpn",
12
+ install(guardian) {
13
+ if (!registerDefaultRules) {
14
+ return;
15
+ }
16
+ guardian.rule({
17
+ name: "VpnDetected",
18
+ reason: "Connection appears to use a VPN",
19
+ when: (s) => s.vpn === true,
20
+ score: vpnScore
21
+ });
22
+ guardian.rule({
23
+ name: "ProxyDetected",
24
+ reason: "Connection appears to use a proxy",
25
+ when: (s) => s.proxy === true,
26
+ score: vpnScore
27
+ });
28
+ guardian.rule({
29
+ name: "TorDetected",
30
+ reason: "Connection appears to use Tor",
31
+ when: (s) => s.tor === true,
32
+ score: vpnScore + 10
33
+ });
34
+ }
35
+ };
36
+ }
37
+ async function checkIp(_ip, guardian) {
38
+ return guardian.signal("signalSource", "vpn").signal("vpn", false).signal("proxy", false).signal("tor", false).signal("country", "unknown");
39
+ }
40
+
41
+ exports.checkIp = checkIp;
42
+ exports.vpnPlugin = vpnPlugin;
43
+ //# sourceMappingURL=index.cjs.map
44
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAqBO,SAAS,SAAA,CAAU,OAAA,GAA4B,EAAC,EAAW;AAChE,EAAA,MAAM;AAAA,IACJ,QAAA,GAAW,SAAA;AAAA,IACX,QAAA,GAAW,EAAA;AAAA,IACX,oBAAA,GAAuB;AAAA,GACzB,GAAI,OAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,mBAAA;AAAA,IACN,QAAQ,QAAA,EAAU;AAGhB,MAAA,IAAI,CAAC,oBAAA,EAAsB;AACzB,QAAA;AAAA,MACF;AAEA,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,iCAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,GAAA,KAAQ,IAAA;AAAA,QACvB,KAAA,EAAO;AAAA,OACR,CAAA;AAED,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,eAAA;AAAA,QACN,MAAA,EAAQ,mCAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,KAAA,KAAU,IAAA;AAAA,QACzB,KAAA,EAAO;AAAA,OACR,CAAA;AAED,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,+BAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,GAAA,KAAQ,IAAA;AAAA,QACvB,OAAO,QAAA,GAAW;AAAA,OACnB,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAKA,eAAsB,OAAA,CACpB,KACA,QAAA,EAC2C;AAC3C,EAAA,OAAO,SACJ,MAAA,CAAO,cAAA,EAAgB,KAAK,CAAA,CAC5B,MAAA,CAAO,OAAO,KAAK,CAAA,CACnB,OAAO,OAAA,EAAS,KAAK,EACrB,MAAA,CAAO,KAAA,EAAO,KAAK,CAAA,CACnB,MAAA,CAAO,WAAW,SAAS,CAAA;AAChC","file":"index.cjs","sourcesContent":["import type { Plugin } from 'guardian-risk';\n\n/** IP intelligence provider (stub). */\nexport type VpnProvider = 'maxmind' | 'ipinfo' | 'custom';\n\n/** Options for the VPN plugin (stub). */\nexport interface VpnPluginOptions {\n /** Provider used to classify IP addresses. */\n readonly provider?: VpnProvider;\n /** Default risk score added when VPN rules are registered by the plugin. */\n readonly vpnScore?: number;\n /** Register default VPN/proxy/Tor rules on install. */\n readonly registerDefaultRules?: boolean;\n}\n\n/**\n * VPN / proxy detection plugin for guardian-risk.\n *\n * @stub Future versions will resolve client IP via MaxMind, IPinfo, or a custom\n * provider and add signals such as `vpn`, `proxy`, `tor`, and `country`.\n */\nexport function vpnPlugin(options: VpnPluginOptions = {}): Plugin {\n const {\n provider = 'maxmind',\n vpnScore = 20,\n registerDefaultRules = true,\n } = options;\n\n return {\n name: 'guardian-risk-vpn',\n install(guardian) {\n void provider;\n\n if (!registerDefaultRules) {\n return;\n }\n\n guardian.rule({\n name: 'VpnDetected',\n reason: 'Connection appears to use a VPN',\n when: (s) => s.vpn === true,\n score: vpnScore,\n });\n\n guardian.rule({\n name: 'ProxyDetected',\n reason: 'Connection appears to use a proxy',\n when: (s) => s.proxy === true,\n score: vpnScore,\n });\n\n guardian.rule({\n name: 'TorDetected',\n reason: 'Connection appears to use Tor',\n when: (s) => s.tor === true,\n score: vpnScore + 10,\n });\n },\n };\n}\n\n/**\n * @stub Future helper to resolve an IP and add VPN-related signals.\n */\nexport async function checkIp(\n _ip: string,\n guardian: import('guardian-risk').Guardian,\n): Promise<import('guardian-risk').Guardian> {\n return guardian\n .signal('signalSource', 'vpn')\n .signal('vpn', false)\n .signal('proxy', false)\n .signal('tor', false)\n .signal('country', 'unknown');\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import * as guardian_risk from 'guardian-risk';
2
+ import { Plugin } from 'guardian-risk';
3
+
4
+ /** IP intelligence provider (stub). */
5
+ type VpnProvider = 'maxmind' | 'ipinfo' | 'custom';
6
+ /** Options for the VPN plugin (stub). */
7
+ interface VpnPluginOptions {
8
+ /** Provider used to classify IP addresses. */
9
+ readonly provider?: VpnProvider;
10
+ /** Default risk score added when VPN rules are registered by the plugin. */
11
+ readonly vpnScore?: number;
12
+ /** Register default VPN/proxy/Tor rules on install. */
13
+ readonly registerDefaultRules?: boolean;
14
+ }
15
+ /**
16
+ * VPN / proxy detection plugin for guardian-risk.
17
+ *
18
+ * @stub Future versions will resolve client IP via MaxMind, IPinfo, or a custom
19
+ * provider and add signals such as `vpn`, `proxy`, `tor`, and `country`.
20
+ */
21
+ declare function vpnPlugin(options?: VpnPluginOptions): Plugin;
22
+ /**
23
+ * @stub Future helper to resolve an IP and add VPN-related signals.
24
+ */
25
+ declare function checkIp(_ip: string, guardian: guardian_risk.Guardian): Promise<guardian_risk.Guardian>;
26
+
27
+ export { type VpnPluginOptions, type VpnProvider, checkIp, vpnPlugin };
@@ -0,0 +1,27 @@
1
+ import * as guardian_risk from 'guardian-risk';
2
+ import { Plugin } from 'guardian-risk';
3
+
4
+ /** IP intelligence provider (stub). */
5
+ type VpnProvider = 'maxmind' | 'ipinfo' | 'custom';
6
+ /** Options for the VPN plugin (stub). */
7
+ interface VpnPluginOptions {
8
+ /** Provider used to classify IP addresses. */
9
+ readonly provider?: VpnProvider;
10
+ /** Default risk score added when VPN rules are registered by the plugin. */
11
+ readonly vpnScore?: number;
12
+ /** Register default VPN/proxy/Tor rules on install. */
13
+ readonly registerDefaultRules?: boolean;
14
+ }
15
+ /**
16
+ * VPN / proxy detection plugin for guardian-risk.
17
+ *
18
+ * @stub Future versions will resolve client IP via MaxMind, IPinfo, or a custom
19
+ * provider and add signals such as `vpn`, `proxy`, `tor`, and `country`.
20
+ */
21
+ declare function vpnPlugin(options?: VpnPluginOptions): Plugin;
22
+ /**
23
+ * @stub Future helper to resolve an IP and add VPN-related signals.
24
+ */
25
+ declare function checkIp(_ip: string, guardian: guardian_risk.Guardian): Promise<guardian_risk.Guardian>;
26
+
27
+ export { type VpnPluginOptions, type VpnProvider, checkIp, vpnPlugin };
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ // src/index.ts
2
+ function vpnPlugin(options = {}) {
3
+ const {
4
+ provider = "maxmind",
5
+ vpnScore = 20,
6
+ registerDefaultRules = true
7
+ } = options;
8
+ return {
9
+ name: "guardian-risk-vpn",
10
+ install(guardian) {
11
+ if (!registerDefaultRules) {
12
+ return;
13
+ }
14
+ guardian.rule({
15
+ name: "VpnDetected",
16
+ reason: "Connection appears to use a VPN",
17
+ when: (s) => s.vpn === true,
18
+ score: vpnScore
19
+ });
20
+ guardian.rule({
21
+ name: "ProxyDetected",
22
+ reason: "Connection appears to use a proxy",
23
+ when: (s) => s.proxy === true,
24
+ score: vpnScore
25
+ });
26
+ guardian.rule({
27
+ name: "TorDetected",
28
+ reason: "Connection appears to use Tor",
29
+ when: (s) => s.tor === true,
30
+ score: vpnScore + 10
31
+ });
32
+ }
33
+ };
34
+ }
35
+ async function checkIp(_ip, guardian) {
36
+ return guardian.signal("signalSource", "vpn").signal("vpn", false).signal("proxy", false).signal("tor", false).signal("country", "unknown");
37
+ }
38
+
39
+ export { checkIp, vpnPlugin };
40
+ //# sourceMappingURL=index.js.map
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAqBO,SAAS,SAAA,CAAU,OAAA,GAA4B,EAAC,EAAW;AAChE,EAAA,MAAM;AAAA,IACJ,QAAA,GAAW,SAAA;AAAA,IACX,QAAA,GAAW,EAAA;AAAA,IACX,oBAAA,GAAuB;AAAA,GACzB,GAAI,OAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,mBAAA;AAAA,IACN,QAAQ,QAAA,EAAU;AAGhB,MAAA,IAAI,CAAC,oBAAA,EAAsB;AACzB,QAAA;AAAA,MACF;AAEA,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,iCAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,GAAA,KAAQ,IAAA;AAAA,QACvB,KAAA,EAAO;AAAA,OACR,CAAA;AAED,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,eAAA;AAAA,QACN,MAAA,EAAQ,mCAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,KAAA,KAAU,IAAA;AAAA,QACzB,KAAA,EAAO;AAAA,OACR,CAAA;AAED,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,+BAAA;AAAA,QACR,IAAA,EAAM,CAAC,CAAA,KAAM,CAAA,CAAE,GAAA,KAAQ,IAAA;AAAA,QACvB,OAAO,QAAA,GAAW;AAAA,OACnB,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAKA,eAAsB,OAAA,CACpB,KACA,QAAA,EAC2C;AAC3C,EAAA,OAAO,SACJ,MAAA,CAAO,cAAA,EAAgB,KAAK,CAAA,CAC5B,MAAA,CAAO,OAAO,KAAK,CAAA,CACnB,OAAO,OAAA,EAAS,KAAK,EACrB,MAAA,CAAO,KAAA,EAAO,KAAK,CAAA,CACnB,MAAA,CAAO,WAAW,SAAS,CAAA;AAChC","file":"index.js","sourcesContent":["import type { Plugin } from 'guardian-risk';\n\n/** IP intelligence provider (stub). */\nexport type VpnProvider = 'maxmind' | 'ipinfo' | 'custom';\n\n/** Options for the VPN plugin (stub). */\nexport interface VpnPluginOptions {\n /** Provider used to classify IP addresses. */\n readonly provider?: VpnProvider;\n /** Default risk score added when VPN rules are registered by the plugin. */\n readonly vpnScore?: number;\n /** Register default VPN/proxy/Tor rules on install. */\n readonly registerDefaultRules?: boolean;\n}\n\n/**\n * VPN / proxy detection plugin for guardian-risk.\n *\n * @stub Future versions will resolve client IP via MaxMind, IPinfo, or a custom\n * provider and add signals such as `vpn`, `proxy`, `tor`, and `country`.\n */\nexport function vpnPlugin(options: VpnPluginOptions = {}): Plugin {\n const {\n provider = 'maxmind',\n vpnScore = 20,\n registerDefaultRules = true,\n } = options;\n\n return {\n name: 'guardian-risk-vpn',\n install(guardian) {\n void provider;\n\n if (!registerDefaultRules) {\n return;\n }\n\n guardian.rule({\n name: 'VpnDetected',\n reason: 'Connection appears to use a VPN',\n when: (s) => s.vpn === true,\n score: vpnScore,\n });\n\n guardian.rule({\n name: 'ProxyDetected',\n reason: 'Connection appears to use a proxy',\n when: (s) => s.proxy === true,\n score: vpnScore,\n });\n\n guardian.rule({\n name: 'TorDetected',\n reason: 'Connection appears to use Tor',\n when: (s) => s.tor === true,\n score: vpnScore + 10,\n });\n },\n };\n}\n\n/**\n * @stub Future helper to resolve an IP and add VPN-related signals.\n */\nexport async function checkIp(\n _ip: string,\n guardian: import('guardian-risk').Guardian,\n): Promise<import('guardian-risk').Guardian> {\n return guardian\n .signal('signalSource', 'vpn')\n .signal('vpn', false)\n .signal('proxy', false)\n .signal('tor', false)\n .signal('country', 'unknown');\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "guardian-risk-vpn",
3
+ "version": "0.1.0",
4
+ "description": "VPN and proxy detection plugin for guardian-risk — adds network risk signals",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "sideEffects": false,
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "engines": {
28
+ "node": ">=20"
29
+ },
30
+ "keywords": [
31
+ "guardian-risk",
32
+ "guardian-risk-vpn",
33
+ "vpn",
34
+ "proxy",
35
+ "tor",
36
+ "ip",
37
+ "fraud",
38
+ "risk"
39
+ ],
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/himanshu6306singh/guardian-risk.git",
44
+ "directory": "packages/vpn"
45
+ },
46
+ "homepage": "https://github.com/himanshu6306singh/guardian-risk/tree/main/packages/vpn#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/himanshu6306singh/guardian-risk/issues"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "peerDependencies": {
54
+ "guardian-risk": "^0.2.0"
55
+ },
56
+ "devDependencies": {
57
+ "tsup": "^8.3.5",
58
+ "typescript": "^5.7.2",
59
+ "guardian-risk": "0.2.0"
60
+ },
61
+ "scripts": {
62
+ "build": "tsup",
63
+ "typecheck": "tsc --noEmit"
64
+ }
65
+ }