@push.rocks/smartvpn 1.19.2 → 1.19.3
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.
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartvpn',
|
|
6
|
-
version: '1.19.
|
|
6
|
+
version: '1.19.3',
|
|
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=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@push.rocks/smartvpn",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A VPN solution with TypeScript control plane and Rust data plane daemon",
|
|
6
6
|
"type": "module",
|
|
@@ -9,12 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"main": "dist_ts/index.js",
|
|
11
11
|
"typings": "dist_ts/index.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "(tsbuild tsfolders) && (tsrust)",
|
|
14
|
-
"test:before": "(tsrust)",
|
|
15
|
-
"test": "tstest test/ --verbose --logfile --timeout 90",
|
|
16
|
-
"buildDocs": "tsdoc"
|
|
17
|
-
},
|
|
18
12
|
"repository": {
|
|
19
13
|
"type": "git",
|
|
20
14
|
"url": "https://code.foss.global/push.rocks/smartvpn.git"
|
|
@@ -29,16 +23,16 @@
|
|
|
29
23
|
],
|
|
30
24
|
"license": "MIT",
|
|
31
25
|
"dependencies": {
|
|
32
|
-
"@push.rocks/smartnftables": "1.
|
|
26
|
+
"@push.rocks/smartnftables": "1.2.0",
|
|
33
27
|
"@push.rocks/smartpath": "^6.0.0",
|
|
34
|
-
"@push.rocks/smartrust": "^1.
|
|
28
|
+
"@push.rocks/smartrust": "^1.4.0"
|
|
35
29
|
},
|
|
36
30
|
"devDependencies": {
|
|
37
|
-
"@git.zone/tsbuild": "^4.4.
|
|
38
|
-
"@git.zone/tsrun": "^2.0.
|
|
39
|
-
"@git.zone/tsrust": "^1.3.
|
|
40
|
-
"@git.zone/tstest": "^3.6.
|
|
41
|
-
"@types/node": "^25.
|
|
31
|
+
"@git.zone/tsbuild": "^4.4.1",
|
|
32
|
+
"@git.zone/tsrun": "^2.0.4",
|
|
33
|
+
"@git.zone/tsrust": "^1.3.4",
|
|
34
|
+
"@git.zone/tstest": "^3.6.6",
|
|
35
|
+
"@types/node": "^25.7.0"
|
|
42
36
|
},
|
|
43
37
|
"files": [
|
|
44
38
|
"ts/**/*",
|
|
@@ -50,5 +44,11 @@
|
|
|
50
44
|
],
|
|
51
45
|
"browserslist": [
|
|
52
46
|
"last 1 chrome versions"
|
|
53
|
-
]
|
|
54
|
-
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "(tsbuild tsfolders) && (tsrust)",
|
|
50
|
+
"test:before": "(tsrust)",
|
|
51
|
+
"test": "tstest test/ --verbose --logfile --timeout 90",
|
|
52
|
+
"buildDocs": "tsdoc"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/readme.md
CHANGED
|
@@ -24,11 +24,9 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
pnpm install @push.rocks/smartvpn
|
|
27
|
-
# or
|
|
28
|
-
npm install @push.rocks/smartvpn
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
The package ships with pre-compiled Rust binaries for **linux/amd64** and **linux/arm64**. No Rust toolchain required at runtime.
|
|
29
|
+
The package ships with pre-compiled Rust binaries for **linux/amd64** and **linux/arm64**. No Rust toolchain is required at runtime. Set `SMARTVPN_RUST_BINARY` if you want the TypeScript bridge to use a custom daemon binary.
|
|
32
30
|
|
|
33
31
|
## Architecture 🏗️
|
|
34
32
|
|
|
@@ -37,7 +35,7 @@ The package ships with pre-compiled Rust binaries for **linux/amd64** and **linu
|
|
|
37
35
|
│ TypeScript Control Plane │ ◄─────────────────────► │ Rust Data Plane Daemon │
|
|
38
36
|
│ │ stdio or Unix sock │ │
|
|
39
37
|
│ VpnServer / VpnClient │ │ Noise IK handshake │
|
|
40
|
-
│ Typed IPC commands │ │
|
|
38
|
+
│ Typed IPC commands │ │ Noise transport encryption │
|
|
41
39
|
│ Config validation │ │ WS + QUIC + WireGuard │
|
|
42
40
|
│ Hub: client management │ │ TUN device, IP pool, NAT │
|
|
43
41
|
│ WireGuard .conf generation │ │ Rate limiting, ACLs, QoS │
|
|
@@ -45,7 +43,7 @@ The package ships with pre-compiled Rust binaries for **linux/amd64** and **linu
|
|
|
45
43
|
└──────────────────────────────┘ └───────────────────────────────┘
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
**Split-plane design** — TypeScript handles orchestration, config, and DX; Rust handles
|
|
46
|
+
**Split-plane design** — TypeScript handles orchestration, config, and DX; Rust handles the hot path with async I/O, framed packet codecs, and the Noise transport state after authentication.
|
|
49
47
|
|
|
50
48
|
### IPC Transport Modes
|
|
51
49
|
|
|
@@ -142,7 +140,7 @@ Every client authenticates with a **Noise IK handshake** (`Noise_IK_25519_ChaCha
|
|
|
142
140
|
| **QUIC** | UDP (via quinn) | Low latency, datagram support for IP packets |
|
|
143
141
|
| **WireGuard** | UDP (via boringtun) | Standard WG clients (iOS, Android, wg-quick) |
|
|
144
142
|
|
|
145
|
-
The server runs
|
|
143
|
+
The server runs with `transportMode: 'all'` by default: WebSocket and QUIC are enabled, and WireGuard joins the same server when `wgPrivateKey` is configured. All server transports share the same forwarding pipeline (`ForwardingEngine`), IP pool, client registry, and statistics, so WireGuard peers can use the same userspace NAT, bridge/hybrid routing, and monitoring model as WS/QUIC clients. Native SmartVPN clients auto-negotiate with `transport: 'auto'` (tries QUIC first, falls back to WS).
|
|
146
144
|
|
|
147
145
|
### 📊 Per-Transport Metrics
|
|
148
146
|
|
|
@@ -481,37 +479,23 @@ const unit = VpnInstaller.generateServiceUnit({
|
|
|
481
479
|
|
|
482
480
|
You can also call `generateSystemdUnit()` or `generateLaunchdPlist()` directly for platform-specific options like custom descriptions.
|
|
483
481
|
|
|
484
|
-
### 📢 Events
|
|
482
|
+
### 📢 Runtime Events
|
|
485
483
|
|
|
486
|
-
|
|
484
|
+
`VpnServer` and `VpnClient` extend `EventEmitter`. The high-level wrappers currently forward bridge lifecycle events:
|
|
487
485
|
|
|
488
486
|
```typescript
|
|
489
|
-
server.on('client-connected', (info: IVpnClientInfo) => {
|
|
490
|
-
console.log(`${info.registeredClientId} connected from ${info.remoteAddr} via ${info.transportType}`);
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
server.on('client-disconnected', ({ clientId, reason }) => {
|
|
494
|
-
console.log(`${clientId} disconnected: ${reason}`);
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
client.on('status', (status: IVpnStatus) => {
|
|
498
|
-
console.log(`State: ${status.state}, IP: ${status.assignedIp}`);
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
// Both server and client emit:
|
|
502
487
|
server.on('exit', ({ code, signal }) => { /* daemon process exited */ });
|
|
503
488
|
server.on('reconnected', () => { /* socket transport reconnected */ });
|
|
489
|
+
client.on('exit', ({ code, signal }) => { /* daemon process exited */ });
|
|
504
490
|
```
|
|
505
491
|
|
|
506
492
|
| Event | Emitted By | Payload |
|
|
507
493
|
|-------|-----------|---------|
|
|
508
|
-
| `status` | Both | `IVpnStatus` — connection state changes |
|
|
509
|
-
| `error` | Both | `{ message, code? }` |
|
|
510
|
-
| `client-connected` | Server | `IVpnClientInfo` — full client info including transport type |
|
|
511
|
-
| `client-disconnected` | Server | `{ clientId, reason? }` |
|
|
512
494
|
| `exit` | Both | `{ code, signal }` — daemon process exited |
|
|
513
495
|
| `reconnected` | Both | `void` — socket transport reconnected |
|
|
514
496
|
|
|
497
|
+
For connection state and telemetry, use `getStatus()`, `getStatistics()`, `listClients()`, and `getClientTelemetry()`.
|
|
498
|
+
|
|
515
499
|
## API Reference 📖
|
|
516
500
|
|
|
517
501
|
### Classes
|
|
@@ -541,7 +525,7 @@ server.on('reconnected', () => { /* socket transport reconnected */ });
|
|
|
541
525
|
| `IVpnMtuInfo` | TUN MTU, effective MTU, overhead bytes, oversized packet stats |
|
|
542
526
|
| `IVpnKeypair` | Base64-encoded public/private key pair |
|
|
543
527
|
| `IDestinationPolicy` | Destination routing policy (forceTarget / block / allow with allow/block lists) |
|
|
544
|
-
| `IVpnEventMap` |
|
|
528
|
+
| `IVpnEventMap` | Exported event payload shapes for lifecycle and daemon event integrations |
|
|
545
529
|
|
|
546
530
|
### Server IPC Commands
|
|
547
531
|
|
|
@@ -600,8 +584,8 @@ All transport modes share the same `forwardingMode` — WireGuard peers can use
|
|
|
600
584
|
// Explicit QUIC with certificate pinning
|
|
601
585
|
{ transport: 'quic', serverUrl: '1.2.3.4:4433', serverCertHash: '<sha256-base64>' }
|
|
602
586
|
|
|
603
|
-
// WireGuard
|
|
604
|
-
|
|
587
|
+
// WireGuard clients use the standard .conf returned by createClient()
|
|
588
|
+
// or generated via WgConfigGenerator.
|
|
605
589
|
```
|
|
606
590
|
|
|
607
591
|
## Cryptography 🔑
|
|
@@ -610,7 +594,7 @@ All transport modes share the same `forwardingMode` — WireGuard peers can use
|
|
|
610
594
|
|-------|-----------|---------|
|
|
611
595
|
| **Handshake** | Noise IK (X25519 + ChaChaPoly + BLAKE2s) | Mutual authentication + key exchange |
|
|
612
596
|
| **Transport** | Noise transport state (ChaChaPoly) | All post-handshake data encryption |
|
|
613
|
-
| **
|
|
597
|
+
| **Utility** | XChaCha20-Poly1305 helper | Nonce-safe symmetric encryption helper in the Rust crypto module |
|
|
614
598
|
| **WireGuard** | X25519 + ChaCha20-Poly1305 (via boringtun) | Standard WireGuard crypto |
|
|
615
599
|
|
|
616
600
|
## Binary Protocol 📡
|
|
@@ -624,6 +608,9 @@ All frames use `[type:1B][length:4B][payload:NB]` with a 64KB max payload:
|
|
|
624
608
|
| IpPacket | `0x10` | Bidirectional | Encrypted tunnel data |
|
|
625
609
|
| Keepalive | `0x20` | Client → Server | App-level keepalive (not WS ping) |
|
|
626
610
|
| KeepaliveAck | `0x21` | Server → Client | Keepalive response with RTT payload |
|
|
611
|
+
| SessionResume | `0x30` | Client → Server | Session resume attempt |
|
|
612
|
+
| SessionResumeOk | `0x31` | Server → Client | Session resume accepted |
|
|
613
|
+
| SessionResumeErr | `0x32` | Server → Client | Session resume rejected |
|
|
627
614
|
| Disconnect | `0x3F` | Bidirectional | Graceful disconnect |
|
|
628
615
|
|
|
629
616
|
## Development 🛠️
|
|
@@ -674,6 +661,7 @@ smartvpn/
|
|
|
674
661
|
│ ├── transport_trait.rs # Transport abstraction (Sink/Stream)
|
|
675
662
|
│ ├── quic_transport.rs # QUIC transport
|
|
676
663
|
│ ├── wireguard.rs # WireGuard (boringtun)
|
|
664
|
+
│ ├── bridge.rs # Linux bridge/TAP integration
|
|
677
665
|
│ ├── codec.rs # Binary frame protocol
|
|
678
666
|
│ ├── keepalive.rs # Adaptive keepalives
|
|
679
667
|
│ ├── ratelimit.rs # Token bucket
|
|
@@ -691,7 +679,7 @@ smartvpn/
|
|
|
691
679
|
|
|
692
680
|
## License and Legal Information
|
|
693
681
|
|
|
694
|
-
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [
|
|
682
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license.md](./license.md) file.
|
|
695
683
|
|
|
696
684
|
**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.
|
|
697
685
|
|