@push.rocks/smartvpn 1.16.5 → 1.17.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartvpn',
6
- version: '1.16.5',
6
+ version: '1.17.0',
7
7
  description: 'A VPN solution with TypeScript control plane and Rust data plane daemon'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLHlFQUF5RTtDQUN2RixDQUFBIn0=
@@ -183,6 +183,14 @@ export interface IVpnClientInfo {
183
183
  export interface IVpnServerStatistics extends IVpnStatistics {
184
184
  activeClients: number;
185
185
  totalConnections: number;
186
+ /** Per-transport active client counts. */
187
+ activeClientsWebsocket: number;
188
+ activeClientsQuic: number;
189
+ activeClientsWireguard: number;
190
+ /** Per-transport total connection counts. */
191
+ totalConnectionsWebsocket: number;
192
+ totalConnectionsQuic: number;
193
+ totalConnectionsWireguard: number;
186
194
  }
187
195
  export interface IVpnKeypair {
188
196
  publicKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartvpn",
3
- "version": "1.16.5",
3
+ "version": "1.17.0",
4
4
  "private": false,
5
5
  "description": "A VPN solution with TypeScript control plane and Rust data plane daemon",
6
6
  "type": "module",
package/readme.md CHANGED
@@ -6,11 +6,12 @@ A high-performance VPN solution with a **TypeScript control plane** and a **Rust
6
6
  🚀 **Triple transport**: WebSocket (Cloudflare-friendly), raw **QUIC** (datagrams), and **WireGuard** (standard protocol)
7
7
  🛡️ **ACL engine** — deny-overrides-allow IP filtering, aligned with SmartProxy conventions
8
8
  🔀 **PROXY protocol v2** — real client IPs behind reverse proxies (HAProxy, SmartProxy, Cloudflare Spectrum)
9
- 📊 **Adaptive QoS**: per-client rate limiting, priority queues, connection quality tracking
9
+ 📊 **Per-transport metrics**: active clients and total connections broken down by websocket, QUIC, and WireGuard
10
10
  🔄 **Hub API**: one `createClient()` call generates keys, assigns IP, returns both SmartVPN + WireGuard configs
11
11
  📡 **Real-time telemetry**: RTT, jitter, loss ratio, link health — all via typed APIs
12
12
  🌐 **Unified forwarding pipeline**: all transports share the same engine — TUN (kernel), userspace NAT (no root), or testing mode
13
13
  🎯 **Destination routing policy**: force-target, block, or allow traffic per destination with nftables integration
14
+ ⚡ **Handshake-driven WireGuard state**: peers appear as "connected" only after a successful WireGuard handshake, and auto-disconnect on idle timeout
14
15
 
15
16
  ## Issue Reporting and Security
16
17
 
@@ -140,6 +141,30 @@ Every client authenticates with a **Noise IK handshake** (`Noise_IK_25519_ChaCha
140
141
 
141
142
  The server runs **all three simultaneously** by default with `transportMode: 'all'`. All transports share the same unified forwarding pipeline (`ForwardingEngine`), IP pool, client registry, and stats — so WireGuard peers get the same userspace NAT, rate limiting, and monitoring as WS/QUIC clients. Clients auto-negotiate with `transport: 'auto'` (tries QUIC first, falls back to WS).
142
143
 
144
+ ### 📊 Per-Transport Metrics
145
+
146
+ Server statistics include per-transport breakdowns so you can see exactly how many clients use each protocol:
147
+
148
+ ```typescript
149
+ const stats = await server.getStatistics();
150
+
151
+ // Aggregate
152
+ console.log(stats.activeClients); // total connected clients
153
+ console.log(stats.totalConnections); // total connections since start
154
+
155
+ // Per-transport active clients
156
+ console.log(stats.activeClientsWebsocket); // currently connected via WS
157
+ console.log(stats.activeClientsQuic); // currently connected via QUIC
158
+ console.log(stats.activeClientsWireguard); // currently connected via WireGuard
159
+
160
+ // Per-transport total connections
161
+ console.log(stats.totalConnectionsWebsocket);
162
+ console.log(stats.totalConnectionsQuic);
163
+ console.log(stats.totalConnectionsWireguard);
164
+ ```
165
+
166
+ **WireGuard connection state is handshake-driven** — registered WireGuard peers do NOT appear as "connected" until their first successful WireGuard handshake completes. They automatically disconnect after 180 seconds of inactivity or when boringtun reports `ConnectionExpired`. This matches how WebSocket/QUIC clients behave: they appear on connection and disappear on disconnect.
167
+
143
168
  ### 🛡️ ACL Engine (SmartProxy-Aligned)
144
169
 
145
170
  Security policies per client, using the same `ipAllowList` / `ipBlockList` naming convention as `@push.rocks/smartproxy`:
@@ -256,8 +281,9 @@ The userspace NAT mode extracts destination IP/port from IP packets, opens a rea
256
281
  - **Connection quality**: Smoothed RTT, jitter, min/max RTT, loss ratio, link health (`healthy` / `degraded` / `critical`)
257
282
  - **Adaptive keepalives**: Interval adjusts based on link health (60s → 30s → 10s)
258
283
  - **Per-client rate limiting**: Token bucket with configurable bytes/sec and burst
259
- - **Dead-peer detection**: 180s inactivity timeout
284
+ - **Dead-peer detection**: 180s inactivity timeout (all transports)
260
285
  - **MTU management**: Automatic overhead calculation (IP+TCP+WS+Noise = 79 bytes)
286
+ - **Per-transport stats**: Active client and total connection counts broken down by websocket, QUIC, and WireGuard
261
287
 
262
288
  ### 🏷️ Client Tags (Trusted vs Informational)
263
289
 
@@ -425,6 +451,7 @@ server.on('reconnected', () => { /* socket transport reconnected */ });
425
451
  | `IClientRateLimit` | Rate limiting config (bytesPerSec, burstBytes) |
426
452
  | `IClientConfigBundle` | Full config bundle returned by `createClient()` — includes SmartVPN config, WireGuard .conf, and secrets |
427
453
  | `IVpnClientInfo` | Connected client info (IP, stats, authenticated key, remote addr, transport type) |
454
+ | `IVpnServerStatistics` | Server stats with per-transport breakdowns (activeClientsWebsocket/Quic/Wireguard, totalConnections*) |
428
455
  | `IVpnConnectionQuality` | RTT, jitter, loss ratio, link health |
429
456
  | `IVpnMtuInfo` | TUN MTU, effective MTU, overhead bytes, oversized packet stats |
430
457
  | `IVpnKeypair` | Base64-encoded public/private key pair |
@@ -443,7 +470,7 @@ server.on('reconnected', () => { /* socket transport reconnected */ });
443
470
  | `exportClientConfig` | Re-export as SmartVPN config or WireGuard `.conf` |
444
471
  | `listClients` / `disconnectClient` | Manage live connections |
445
472
  | `setClientRateLimit` / `removeClientRateLimit` | Runtime rate limit adjustments |
446
- | `getStatus` / `getStatistics` / `getClientTelemetry` | Monitoring |
473
+ | `getStatus` / `getStatistics` / `getClientTelemetry` | Monitoring (stats include per-transport breakdowns) |
447
474
  | `generateKeypair` / `generateWgKeypair` / `generateClientKeypair` | Key generation |
448
475
  | `addWgPeer` / `removeWgPeer` / `listWgPeers` | WireGuard peer management |
449
476
 
@@ -541,6 +568,7 @@ smartvpn/
541
568
  │ ├── index.ts # All exports
542
569
  │ ├── smartvpn.interfaces.ts # Interfaces, types, IPC command maps
543
570
  │ ├── smartvpn.plugins.ts # Dependency imports
571
+ │ ├── smartvpn.paths.ts # Binary path resolution
544
572
  │ ├── smartvpn.classes.vpnserver.ts
545
573
  │ ├── smartvpn.classes.vpnclient.ts
546
574
  │ ├── smartvpn.classes.vpnbridge.ts
@@ -558,13 +586,19 @@ smartvpn/
558
586
  │ ├── proxy_protocol.rs # PROXY protocol v2 parser
559
587
  │ ├── management.rs # JSON-lines IPC
560
588
  │ ├── transport.rs # WebSocket transport
589
+ │ ├── transport_trait.rs # Transport abstraction (Sink/Stream)
561
590
  │ ├── quic_transport.rs # QUIC transport
562
591
  │ ├── wireguard.rs # WireGuard (boringtun)
563
592
  │ ├── codec.rs # Binary frame protocol
564
593
  │ ├── keepalive.rs # Adaptive keepalives
565
594
  │ ├── ratelimit.rs # Token bucket
566
595
  │ ├── userspace_nat.rs # Userspace TCP/UDP NAT proxy
567
- └── ... # tunnel, network, telemetry, qos, mtu, reconnect
596
+ ├── tunnel.rs # TUN device management
597
+ │ ├── network.rs # IP pool + networking
598
+ │ ├── telemetry.rs # RTT/jitter/loss tracking
599
+ │ ├── qos.rs # Priority queues + smart dropping
600
+ │ ├── mtu.rs # MTU + ICMP too-big
601
+ │ └── reconnect.rs # Exponential backoff + session tokens
568
602
  ├── test/ # Test files
569
603
  ├── dist_ts/ # Compiled TypeScript
570
604
  └── dist_rust/ # Cross-compiled binaries (linux amd64 + arm64)
@@ -572,7 +606,7 @@ smartvpn/
572
606
 
573
607
  ## License and Legal Information
574
608
 
575
- This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license.md) file.
609
+ This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
576
610
 
577
611
  **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
578
612
 
@@ -584,7 +618,7 @@ Use of these trademarks must comply with Task Venture Capital GmbH's Trademark G
584
618
 
585
619
  ### Company Information
586
620
 
587
- Task Venture Capital GmbH
621
+ Task Venture Capital GmbH
588
622
  Registered at District Court Bremen HRB 35230 HB, Germany
589
623
 
590
624
  For any legal inquiries or further information, please contact us via email at hello@task.vc.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartvpn',
6
- version: '1.16.5',
6
+ version: '1.17.0',
7
7
  description: 'A VPN solution with TypeScript control plane and Rust data plane daemon'
8
8
  }
@@ -217,6 +217,14 @@ export interface IVpnClientInfo {
217
217
  export interface IVpnServerStatistics extends IVpnStatistics {
218
218
  activeClients: number;
219
219
  totalConnections: number;
220
+ /** Per-transport active client counts. */
221
+ activeClientsWebsocket: number;
222
+ activeClientsQuic: number;
223
+ activeClientsWireguard: number;
224
+ /** Per-transport total connection counts. */
225
+ totalConnectionsWebsocket: number;
226
+ totalConnectionsQuic: number;
227
+ totalConnectionsWireguard: number;
220
228
  }
221
229
 
222
230
  export interface IVpnKeypair {