blue-js-sdk 2.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/CHANGELOG.md +446 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/ai-path/ADMIN-ELEVATION.md +116 -0
- package/ai-path/AI-MANIFESTO.md +185 -0
- package/ai-path/BREAKING.md +74 -0
- package/ai-path/CHECKLIST.md +619 -0
- package/ai-path/CONNECTION-STEPS.md +724 -0
- package/ai-path/DECISION-TREE.md +378 -0
- package/ai-path/DEPENDENCIES.md +459 -0
- package/ai-path/E2E-FLOW.md +1555 -0
- package/ai-path/FAILURES.md +403 -0
- package/ai-path/GUIDE.md +1217 -0
- package/ai-path/README.md +558 -0
- package/ai-path/SPLIT-TUNNEL.md +266 -0
- package/ai-path/cli.js +535 -0
- package/ai-path/connect.js +884 -0
- package/ai-path/discover.js +178 -0
- package/ai-path/environment.js +266 -0
- package/ai-path/errors.js +86 -0
- package/ai-path/examples/autonomous-agent.mjs +220 -0
- package/ai-path/examples/multi-region.mjs +174 -0
- package/ai-path/examples/one-shot.mjs +31 -0
- package/ai-path/index.js +60 -0
- package/ai-path/pricing.js +136 -0
- package/ai-path/recommend.js +413 -0
- package/ai-path/run-admin.vbs +25 -0
- package/ai-path/setup.js +291 -0
- package/ai-path/wallet.js +137 -0
- package/app-helpers.js +363 -0
- package/app-settings.js +95 -0
- package/app-types.js +267 -0
- package/audit.js +847 -0
- package/batch.js +293 -0
- package/bin/setup.js +376 -0
- package/chain/authz.js +109 -0
- package/chain/broadcast.js +472 -0
- package/chain/client.js +160 -0
- package/chain/fee-grants.js +305 -0
- package/chain/index.js +891 -0
- package/chain/lcd.js +313 -0
- package/chain/queries.js +547 -0
- package/chain/rpc.js +408 -0
- package/chain/wallet.js +141 -0
- package/cli/config.js +143 -0
- package/cli/index.js +463 -0
- package/cli/output.js +182 -0
- package/cli.js +491 -0
- package/client/index.js +251 -0
- package/client.js +271 -0
- package/config/index.js +255 -0
- package/connection/connect.js +849 -0
- package/connection/disconnect.js +180 -0
- package/connection/discovery.js +321 -0
- package/connection/index.js +76 -0
- package/connection/proxy.js +148 -0
- package/connection/resilience.js +428 -0
- package/connection/security.js +232 -0
- package/connection/state.js +369 -0
- package/connection/tunnel.js +691 -0
- package/consumer.js +132 -0
- package/cosmjs-setup.js +1884 -0
- package/defaults.js +366 -0
- package/disk-cache.js +107 -0
- package/dist/client.d.ts +108 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +400 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/errors/index.js +112 -0
- package/errors.js +218 -0
- package/examples/README.md +64 -0
- package/examples/connect-direct.mjs +106 -0
- package/examples/connect-plan.mjs +125 -0
- package/examples/error-handling.mjs +109 -0
- package/examples/query-nodes.mjs +94 -0
- package/examples/wallet-basics.mjs +61 -0
- package/generated/amino/amino.ts +9 -0
- package/generated/cosmos/base/v1beta1/coin.ts +365 -0
- package/generated/cosmos_proto/cosmos.ts +323 -0
- package/generated/gogoproto/gogo.ts +9 -0
- package/generated/google/protobuf/descriptor.ts +7601 -0
- package/generated/google/protobuf/duration.ts +208 -0
- package/generated/google/protobuf/timestamp.ts +238 -0
- package/generated/sentinel/lease/v1/events.ts +924 -0
- package/generated/sentinel/lease/v1/lease.ts +292 -0
- package/generated/sentinel/lease/v1/msg.ts +949 -0
- package/generated/sentinel/lease/v1/params.ts +164 -0
- package/generated/sentinel/node/v3/events.ts +881 -0
- package/generated/sentinel/node/v3/msg.ts +1002 -0
- package/generated/sentinel/node/v3/node.ts +263 -0
- package/generated/sentinel/node/v3/params.ts +183 -0
- package/generated/sentinel/plan/v3/events.ts +675 -0
- package/generated/sentinel/plan/v3/msg.ts +1191 -0
- package/generated/sentinel/plan/v3/plan.ts +283 -0
- package/generated/sentinel/provider/v2/events.ts +171 -0
- package/generated/sentinel/provider/v2/msg.ts +480 -0
- package/generated/sentinel/provider/v2/params.ts +131 -0
- package/generated/sentinel/provider/v2/provider.ts +246 -0
- package/generated/sentinel/session/v3/events.ts +480 -0
- package/generated/sentinel/session/v3/msg.ts +616 -0
- package/generated/sentinel/session/v3/params.ts +260 -0
- package/generated/sentinel/session/v3/proof.ts +180 -0
- package/generated/sentinel/session/v3/session.ts +384 -0
- package/generated/sentinel/subscription/v3/events.ts +1181 -0
- package/generated/sentinel/subscription/v3/msg.ts +1305 -0
- package/generated/sentinel/subscription/v3/params.ts +167 -0
- package/generated/sentinel/subscription/v3/subscription.ts +315 -0
- package/generated/sentinel/types/v1/bandwidth.ts +124 -0
- package/generated/sentinel/types/v1/price.ts +149 -0
- package/generated/sentinel/types/v1/renewal.ts +87 -0
- package/generated/sentinel/types/v1/status.ts +54 -0
- package/generated/typeRegistry.ts +27 -0
- package/index.js +486 -0
- package/node-connect.js +3015 -0
- package/operator.js +134 -0
- package/package.json +113 -0
- package/plan-operations.js +199 -0
- package/preflight.js +352 -0
- package/pricing/index.js +262 -0
- package/proto/amino/amino.proto +84 -0
- package/proto/cosmos/base/v1beta1/coin.proto +61 -0
- package/proto/cosmos_proto/cosmos.proto +112 -0
- package/proto/gogoproto/gogo.proto +145 -0
- package/proto/google/api/annotations.proto +31 -0
- package/proto/google/api/http.proto +370 -0
- package/proto/google/protobuf/any.proto +106 -0
- package/proto/google/protobuf/duration.proto +115 -0
- package/proto/google/protobuf/timestamp.proto +145 -0
- package/proto/sentinel/lease/v1/events.proto +52 -0
- package/proto/sentinel/lease/v1/genesis.proto +15 -0
- package/proto/sentinel/lease/v1/lease.proto +25 -0
- package/proto/sentinel/lease/v1/msg.proto +62 -0
- package/proto/sentinel/lease/v1/params.proto +17 -0
- package/proto/sentinel/node/v3/events.proto +50 -0
- package/proto/sentinel/node/v3/genesis.proto +15 -0
- package/proto/sentinel/node/v3/msg.proto +63 -0
- package/proto/sentinel/node/v3/node.proto +27 -0
- package/proto/sentinel/node/v3/params.proto +21 -0
- package/proto/sentinel/node/v3/querier.proto +63 -0
- package/proto/sentinel/plan/v3/events.proto +41 -0
- package/proto/sentinel/plan/v3/genesis.proto +21 -0
- package/proto/sentinel/plan/v3/msg.proto +83 -0
- package/proto/sentinel/plan/v3/plan.proto +32 -0
- package/proto/sentinel/plan/v3/querier.proto +53 -0
- package/proto/sentinel/provider/v2/events.proto +16 -0
- package/proto/sentinel/provider/v2/genesis.proto +15 -0
- package/proto/sentinel/provider/v2/msg.proto +35 -0
- package/proto/sentinel/provider/v2/params.proto +17 -0
- package/proto/sentinel/provider/v2/provider.proto +24 -0
- package/proto/sentinel/provider/v3/genesis.proto +15 -0
- package/proto/sentinel/provider/v3/params.proto +13 -0
- package/proto/sentinel/session/v3/events.proto +30 -0
- package/proto/sentinel/session/v3/genesis.proto +15 -0
- package/proto/sentinel/session/v3/msg.proto +50 -0
- package/proto/sentinel/session/v3/params.proto +25 -0
- package/proto/sentinel/session/v3/proof.proto +25 -0
- package/proto/sentinel/session/v3/querier.proto +100 -0
- package/proto/sentinel/session/v3/session.proto +50 -0
- package/proto/sentinel/subscription/v2/allocation.proto +21 -0
- package/proto/sentinel/subscription/v2/payout.proto +22 -0
- package/proto/sentinel/subscription/v3/events.proto +65 -0
- package/proto/sentinel/subscription/v3/genesis.proto +17 -0
- package/proto/sentinel/subscription/v3/msg.proto +83 -0
- package/proto/sentinel/subscription/v3/params.proto +21 -0
- package/proto/sentinel/subscription/v3/subscription.proto +33 -0
- package/proto/sentinel/types/v1/bandwidth.proto +19 -0
- package/proto/sentinel/types/v1/price.proto +21 -0
- package/proto/sentinel/types/v1/renewal.proto +21 -0
- package/proto/sentinel/types/v1/status.proto +16 -0
- package/protocol/encoding.js +341 -0
- package/protocol/events.js +361 -0
- package/protocol/handshake.js +297 -0
- package/protocol/index.js +15 -0
- package/protocol/messages.js +346 -0
- package/protocol/plans.js +199 -0
- package/protocol/v2ray.js +268 -0
- package/protocol/v3.js +723 -0
- package/protocol/wireguard.js +125 -0
- package/security/index.js +132 -0
- package/session-manager.js +329 -0
- package/session-tracker.js +80 -0
- package/setup.js +376 -0
- package/speedtest/index.js +528 -0
- package/speedtest.js +567 -0
- package/src/client.ts +502 -0
- package/src/index.ts +20 -0
- package/state/index.js +347 -0
- package/state.js +516 -0
- package/test-all-chain-ops.js +493 -0
- package/test-all-logic.js +199 -0
- package/test-all-msg-types.js +292 -0
- package/test-every-connection.js +208 -0
- package/test-feegrant-connect.js +98 -0
- package/test-logic.js +148 -0
- package/test-mainnet.js +176 -0
- package/test-plan-lifecycle.js +335 -0
- package/tls-trust.js +132 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +34 -0
- package/types/chain.d.ts +746 -0
- package/types/connection.d.ts +425 -0
- package/types/errors.d.ts +174 -0
- package/types/index.d.ts +1380 -0
- package/types/nodes.d.ts +187 -0
- package/types/pricing.d.ts +156 -0
- package/types/protocol.d.ts +332 -0
- package/types/session.d.ts +236 -0
- package/types/settings.d.ts +192 -0
- package/v3protocol.js +1053 -0
- package/wallet/index.js +153 -0
- package/wireguard.js +307 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Split Tunneling — Selective Encryption for AI Agents
|
|
2
|
+
|
|
3
|
+
> **The most efficient way for an AI agent to use a VPN: encrypt only what needs encrypting, leave everything else on direct internet.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## CRITICAL WARNINGS — Read Before Writing ANY Code
|
|
8
|
+
|
|
9
|
+
> **Rule 36: NEVER use native `fetch()` for V2Ray traffic.** Node.js `fetch()` silently ignores SOCKS5 proxy. You WILL get your real IP, not the VPN IP. Use `axios` with `SocksProxyAgent` for ALL V2Ray verification, speed tests, and IP checks. This is the #1 mistake every AI builder makes.
|
|
10
|
+
|
|
11
|
+
> **Rule 37: V2Ray split tunnel IS the SOCKS5 proxy.** V2Ray does not change system routing. Only traffic you explicitly send through `socks5://127.0.0.1:{port}` goes through the VPN. Everything else is direct. There is no kernel-level full tunnel for V2Ray.
|
|
12
|
+
|
|
13
|
+
> **Rule 38: WireGuard split tunnel requires exact destination IPs.** `splitIPs` takes IP addresses, not domains. CDN/anycast services resolve to hundreds of IPs. Use V2Ray SOCKS5 for per-app routing, WireGuard splitIPs only for known static IPs.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why Split Tunnel Matters for AI Agents
|
|
18
|
+
|
|
19
|
+
A full VPN tunnel routes **all** traffic through a single remote node — your chain queries, your API calls, your data collection, your package downloads, everything. For an AI agent, this creates problems:
|
|
20
|
+
|
|
21
|
+
| Full Tunnel | Split Tunnel |
|
|
22
|
+
|-------------|-------------|
|
|
23
|
+
| All traffic through VPN (~3-15 Mbps median) | Only selected traffic through VPN |
|
|
24
|
+
| Chain queries slow (LCD/RPC through VPN) | Chain queries at full speed (direct) |
|
|
25
|
+
| SDK operations may timeout | SDK operations always fast |
|
|
26
|
+
| Single point of failure | VPN failure doesn't break the agent |
|
|
27
|
+
| Consumes more bandwidth (higher cost) | Only pays for traffic that needs privacy |
|
|
28
|
+
|
|
29
|
+
**Split tunneling lets an AI agent encrypt one specific operation — a web scrape, an API call, a data fetch — while its own infrastructure calls (blockchain, npm, internal APIs) run at full speed on direct internet.**
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Two Modes of Split Tunnel
|
|
34
|
+
|
|
35
|
+
### Mode 1: Per-Application (V2Ray SOCKS5 Proxy)
|
|
36
|
+
|
|
37
|
+
V2Ray creates a local SOCKS5 proxy. **Only traffic you explicitly route through the proxy goes through the VPN.** Everything else uses direct internet.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Your agent process
|
|
41
|
+
├── HTTP request via SOCKS5 proxy → V2Ray → VPN Node → Internet (VPN IP)
|
|
42
|
+
├── HTTP request direct → Internet (Real IP)
|
|
43
|
+
├── Chain query (LCD/RPC) → Internet (Real IP, fast)
|
|
44
|
+
└── npm install → Internet (Real IP, fast)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**This is the recommended mode for AI agents.** You choose exactly which requests need privacy.
|
|
48
|
+
|
|
49
|
+
#### How to Use
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { connect, disconnect } from 'sentinel-ai-connect';
|
|
53
|
+
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
54
|
+
import axios from 'axios';
|
|
55
|
+
|
|
56
|
+
// Connect — V2Ray creates a SOCKS5 proxy on localhost
|
|
57
|
+
const vpn = await connect({
|
|
58
|
+
mnemonic: process.env.MNEMONIC,
|
|
59
|
+
protocol: 'v2ray',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
console.log(`SOCKS5 proxy ready at 127.0.0.1:${vpn.socksPort}`);
|
|
63
|
+
|
|
64
|
+
// ─── Route SPECIFIC requests through VPN ─────────────────────
|
|
65
|
+
const agent = new SocksProxyAgent(`socks5h://127.0.0.1:${vpn.socksPort}`);
|
|
66
|
+
|
|
67
|
+
// This request goes through VPN (shows VPN IP)
|
|
68
|
+
const vpnRes = await axios.get('https://api.ipify.org?format=json', {
|
|
69
|
+
httpAgent: agent,
|
|
70
|
+
httpsAgent: agent,
|
|
71
|
+
adapter: 'http',
|
|
72
|
+
});
|
|
73
|
+
console.log('VPN IP:', vpnRes.data.ip);
|
|
74
|
+
|
|
75
|
+
// ─── Direct requests bypass VPN ──────────────────────────────
|
|
76
|
+
|
|
77
|
+
// This request goes direct (shows real IP)
|
|
78
|
+
const directRes = await axios.get('https://api.ipify.org?format=json', {
|
|
79
|
+
adapter: 'http',
|
|
80
|
+
});
|
|
81
|
+
console.log('Real IP:', directRes.data.ip);
|
|
82
|
+
|
|
83
|
+
// ─── Chain queries always fast (direct) ──────────────────────
|
|
84
|
+
|
|
85
|
+
// LCD query — no proxy, full speed
|
|
86
|
+
const nodes = await fetch('https://lcd.sentinel.co/sentinel/node/v3/nodes?status=1&pagination.limit=5');
|
|
87
|
+
// This never touches the VPN
|
|
88
|
+
|
|
89
|
+
await disconnect();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Using with curl
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Through VPN (shows VPN IP)
|
|
96
|
+
curl --proxy socks5://127.0.0.1:11336 https://api.ipify.org
|
|
97
|
+
|
|
98
|
+
# Direct (shows real IP)
|
|
99
|
+
curl https://api.ipify.org
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Using with a Browser
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Launch Chrome with all traffic through VPN
|
|
106
|
+
chrome.exe --proxy-server="socks5://127.0.0.1:11336" --user-data-dir="/tmp/chrome-vpn"
|
|
107
|
+
|
|
108
|
+
# Regular Chrome instance stays on direct internet
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Key Points
|
|
112
|
+
- SOCKS5 proxy binds to `127.0.0.1` only — not accessible from other machines
|
|
113
|
+
- Default: no authentication required (safe for localhost)
|
|
114
|
+
- Opt into password auth with `socksAuth: true` for defense-in-depth
|
|
115
|
+
- **IMPORTANT:** Use `axios` with `adapter: 'http'`, NOT native `fetch()` — Node.js `fetch()` silently ignores SOCKS5 proxy settings
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### Mode 2: Per-Destination (WireGuard Split IPs)
|
|
120
|
+
|
|
121
|
+
WireGuard routes traffic based on destination IP ranges. **Only traffic going to specified IPs routes through the VPN.** Everything else uses direct internet.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Your agent process
|
|
125
|
+
├── Request to 10.0.0.0/8 → WireGuard → VPN Node → 10.0.0.x (VPN)
|
|
126
|
+
├── Request to 192.168.1.0/24 → WireGuard → VPN Node → 192.168.1.x (VPN)
|
|
127
|
+
├── Request to any other IP → Internet (Real IP, direct)
|
|
128
|
+
└── Chain query (LCD/RPC) → Internet (Real IP, fast)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Use this when you know the exact IP addresses or subnets you need to access through VPN.**
|
|
132
|
+
|
|
133
|
+
#### How to Use
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import { connect, disconnect } from 'sentinel-ai-connect';
|
|
137
|
+
|
|
138
|
+
// Connect with specific IPs routed through VPN
|
|
139
|
+
const vpn = await connect({
|
|
140
|
+
mnemonic: process.env.MNEMONIC,
|
|
141
|
+
protocol: 'wireguard',
|
|
142
|
+
splitIPs: ['10.0.0.0/8', '192.168.0.0/16'],
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Traffic to 10.x.x.x or 192.168.x.x goes through VPN
|
|
146
|
+
// All other traffic goes direct
|
|
147
|
+
|
|
148
|
+
await disconnect();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Limitations
|
|
152
|
+
- Routes by **destination IP**, not by application — all apps sending to those IPs use VPN
|
|
153
|
+
- Requires admin privileges (WireGuard kernel tunnel)
|
|
154
|
+
- DNS queries may leak to your ISP (split tunnel disables VPN DNS)
|
|
155
|
+
- CDN/anycast services (Cloudflare, Google) resolve to many IPs — hard to target
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Which Mode Should Your Agent Use?
|
|
160
|
+
|
|
161
|
+
| Scenario | Recommended Mode | Why |
|
|
162
|
+
|----------|-----------------|-----|
|
|
163
|
+
| **Web scraping with privacy** | V2Ray (per-app) | Route scraper through proxy, keep SDK/chain direct |
|
|
164
|
+
| **Accessing geo-blocked APIs** | V2Ray (per-app) | Proxy only the API calls that need the exit country |
|
|
165
|
+
| **Bulk data collection** | V2Ray (per-app) | Control exactly which requests are private |
|
|
166
|
+
| **Accessing a specific blocked server** | WireGuard (split IPs) | Route only that server's IP through VPN |
|
|
167
|
+
| **Full device privacy** | WireGuard (full tunnel) | Route everything — use `fullTunnel: true` (default) |
|
|
168
|
+
| **Maximum agent efficiency** | V2Ray (per-app) | Keeps chain queries fast, only encrypt what matters |
|
|
169
|
+
|
|
170
|
+
### The Efficiency Argument
|
|
171
|
+
|
|
172
|
+
An AI agent running with a full VPN tunnel spends **~3x more time** on chain operations because every LCD/RPC query routes through a 3-15 Mbps tunnel instead of direct internet. Split tunnel eliminates this overhead:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Full tunnel:
|
|
176
|
+
connect() → 50s (chain queries through VPN)
|
|
177
|
+
LCD query → 3s (through VPN)
|
|
178
|
+
RPC broadcast → 5s (through VPN)
|
|
179
|
+
Total overhead: ~8s per chain operation
|
|
180
|
+
|
|
181
|
+
Split tunnel (V2Ray):
|
|
182
|
+
connect() → 50s (chain queries direct — same speed)
|
|
183
|
+
LCD query → 0.3s (direct)
|
|
184
|
+
RPC broadcast → 0.5s (direct)
|
|
185
|
+
Total overhead: ~0.8s per chain operation
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**For long-running agents** making frequent balance checks, session queries, or multi-step chain operations, split tunnel can reduce operational overhead by **10x**.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Real-Time Processing Pattern
|
|
193
|
+
|
|
194
|
+
For AI agents that need to process data in real-time while maintaining selective privacy:
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
import { connect, disconnect } from 'sentinel-ai-connect';
|
|
198
|
+
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
199
|
+
import axios from 'axios';
|
|
200
|
+
|
|
201
|
+
// Connect V2Ray — split tunnel by default
|
|
202
|
+
const vpn = await connect({
|
|
203
|
+
mnemonic: process.env.MNEMONIC,
|
|
204
|
+
protocol: 'v2ray',
|
|
205
|
+
fullTunnel: false,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const proxy = new SocksProxyAgent(`socks5h://127.0.0.1:${vpn.socksPort}`);
|
|
209
|
+
|
|
210
|
+
// Create two HTTP clients — one private, one direct
|
|
211
|
+
const privateHttp = axios.create({
|
|
212
|
+
httpAgent: proxy,
|
|
213
|
+
httpsAgent: proxy,
|
|
214
|
+
adapter: 'http',
|
|
215
|
+
timeout: 30000,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const directHttp = axios.create({
|
|
219
|
+
adapter: 'http',
|
|
220
|
+
timeout: 10000,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// ─── Real-time processing loop ───────────────────────────────
|
|
224
|
+
|
|
225
|
+
while (running) {
|
|
226
|
+
// Private: fetch sensitive data through VPN
|
|
227
|
+
const data = await privateHttp.get('https://sensitive-api.example.com/data');
|
|
228
|
+
|
|
229
|
+
// Direct: process with fast local/cloud APIs (no VPN overhead)
|
|
230
|
+
const result = await directHttp.post('https://my-processing-api.com/analyze', {
|
|
231
|
+
data: data.data,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Direct: store results (no VPN needed)
|
|
235
|
+
await directHttp.post('https://my-database.com/results', result.data);
|
|
236
|
+
|
|
237
|
+
// Direct: check VPN balance (chain query, fast)
|
|
238
|
+
const bal = await getBalance(mnemonic);
|
|
239
|
+
if (!bal.funded) break; // Top up needed
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
await disconnect();
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Configuration Reference
|
|
248
|
+
|
|
249
|
+
| Option | Default | Effect |
|
|
250
|
+
|--------|---------|--------|
|
|
251
|
+
| `protocol: 'v2ray'` | Auto | Creates SOCKS5 proxy — per-application split tunnel |
|
|
252
|
+
| `protocol: 'wireguard'` | Auto | Creates kernel tunnel — per-destination or full |
|
|
253
|
+
| `fullTunnel: true` | `true` | WireGuard: route ALL traffic. V2Ray: set system proxy |
|
|
254
|
+
| `fullTunnel: false` | — | WireGuard: route only splitIPs. V2Ray: no system proxy |
|
|
255
|
+
| `splitIPs: ['10.0.0.0/8']` | — | WireGuard only: specific IPs through VPN |
|
|
256
|
+
| `systemProxy: false` | `true` | V2Ray: don't set Windows system proxy |
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Security Notes
|
|
261
|
+
|
|
262
|
+
- **V2Ray split tunnel:** Only traffic explicitly sent through the SOCKS5 proxy is encrypted. DNS queries from direct requests leak to your ISP.
|
|
263
|
+
- **WireGuard split tunnel:** DNS is handled by your system (not the VPN). Use `dns: 'cloudflare'` or `dns: 'google'` for direct queries.
|
|
264
|
+
- **Neither mode encrypts traffic to non-VPN destinations.** Only traffic routed through the tunnel gets the VPN's encryption.
|
|
265
|
+
- **For maximum privacy:** Use `fullTunnel: true` with WireGuard. This encrypts everything. Use split tunnel only when efficiency matters more than total privacy.
|
|
266
|
+
- **Kill Switch: UNTESTED.** The kill switch code exists (enableKillSwitch/disableKillSwitch in node-connect.js) but has never been tested against a live node on mainnet. Do not rely on it for production privacy. WireGuard only — V2Ray has no kill switch support.
|