@serve.zone/dcrouter 11.18.0 → 11.19.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.
@@ -43361,4 +43361,4 @@ ibantools/jsnext/ibantools.js:
43361
43361
  * @preferred
43362
43362
  *)
43363
43363
  */
43364
- //# sourceMappingURL=bundle-1774890576398.js.map
43364
+ //# sourceMappingURL=bundle-1774891496876.js.map
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '11.18.0',
6
+ version: '11.19.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLFNBQVM7SUFDbEIsV0FBVyxFQUFFLDBFQUEwRTtDQUN4RixDQUFBIn0=
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '11.18.0',
6
+ version: '11.19.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfd2ViLzAwX2NvbW1pdGluZm9fZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLFVBQVUsR0FBRztJQUN4QixJQUFJLEVBQUUsc0JBQXNCO0lBQzVCLE9BQU8sRUFBRSxTQUFTO0lBQ2xCLFdBQVcsRUFBRSwwRUFBMEU7Q0FDeEYsQ0FBQSJ9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@serve.zone/dcrouter",
3
3
  "private": false,
4
- "version": "11.18.0",
4
+ "version": "11.19.0",
5
5
  "description": "A multifaceted routing service handling mail and SMS delivery functions.",
6
6
  "type": "module",
7
7
  "exports": {
package/readme.md CHANGED
@@ -77,10 +77,13 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
77
77
  ### 🔐 VPN Access Control (powered by [smartvpn](https://code.foss.global/push.rocks/smartvpn))
78
78
  - **WireGuard + native transports** — standard WireGuard clients (iOS, Android, macOS, Windows, Linux) plus custom WebSocket/QUIC tunnels
79
79
  - **Route-level VPN gating** — mark any route with `vpn: { required: true }` to restrict access to VPN clients only
80
- - **Rootless operation** — auto-detects privileges: kernel TUN when running as root, userspace NAT (smoltcp) when not
81
- - **Client management** — create, enable, disable, rotate keys, export WireGuard `.conf` files via OpsServer API
80
+ - **Tag-based access control** — assign `serverDefinedClientTags` to clients and restrict routes with `allowedServerDefinedClientTags`
81
+ - **Constructor-defined clients** — pre-define VPN clients with tags in config for declarative, code-driven setup
82
+ - **Rootless operation** — uses userspace NAT (smoltcp) with no root required
83
+ - **Destination policy** — configurable `forceTarget`, `block`, or `allow` with allowList/blockList for granular traffic control
84
+ - **Client management** — create, enable, disable, rotate keys, export WireGuard/SmartVPN configs via OpsServer API and dashboard
82
85
  - **IP-based enforcement** — VPN clients get IPs from a configurable subnet; SmartProxy enforces `ipAllowList` per route
83
- - **PROXY protocol v2** — in socket mode, the NAT engine sends PP v2 on outbound connections to preserve VPN client identity
86
+ - **PROXY protocol v2** — the NAT engine sends PP v2 on outbound connections to preserve VPN client identity
84
87
 
85
88
  ### ⚡ High Performance
86
89
  - **Rust-powered proxy engine** via SmartProxy for maximum throughput
@@ -261,7 +264,9 @@ const router = new DcRouter({
261
264
  vpnConfig: {
262
265
  enabled: true,
263
266
  serverEndpoint: 'vpn.example.com',
264
- wgListenPort: 51820,
267
+ clients: [
268
+ { clientId: 'dev-laptop', serverDefinedClientTags: ['engineering'] },
269
+ ],
265
270
  },
266
271
 
267
272
  // Persistent storage
@@ -456,7 +461,17 @@ interface IDcRouterOptions {
456
461
  wgListenPort?: number; // default: 51820
457
462
  dns?: string[]; // DNS servers pushed to VPN clients
458
463
  serverEndpoint?: string; // Hostname in generated client configs
459
- forwardingMode?: 'tun' | 'socket'; // default: auto-detect (root → tun, else socket)
464
+ clients?: Array<{ // Pre-defined VPN clients
465
+ clientId: string;
466
+ serverDefinedClientTags?: string[];
467
+ description?: string;
468
+ }>;
469
+ destinationPolicy?: { // Traffic routing policy
470
+ default: 'forceTarget' | 'block' | 'allow';
471
+ target?: string; // IP for forceTarget (default: '127.0.0.1')
472
+ allowList?: string[]; // Pass through directly
473
+ blockList?: string[]; // Always block (overrides allowList)
474
+ };
460
475
  };
461
476
 
462
477
  // ── HTTP/3 (QUIC) ────────────────────────────────────────────
@@ -1014,17 +1029,33 @@ DcRouter integrates [`@push.rocks/smartvpn`](https://code.foss.global/push.rocks
1014
1029
 
1015
1030
  1. **SmartVPN daemon** runs inside dcrouter with a Rust data plane (WireGuard via `boringtun`, custom protocol via Noise IK)
1016
1031
  2. Clients connect and get assigned an IP from the VPN subnet (e.g. `10.8.0.0/24`)
1017
- 3. Routes with `vpn: { required: true }` get `security.ipAllowList` automatically injected with the VPN subnet
1018
- 4. SmartProxy enforces the allowlist only VPN-sourced traffic is accepted on those routes
1032
+ 3. Routes with `vpn: { required: true }` get `security.ipAllowList` automatically injected
1033
+ 4. When `allowedServerDefinedClientTags` is set, only matching client IPs are injected (not the whole subnet)
1034
+ 5. SmartProxy enforces the allowlist — only authorized VPN clients can access protected routes
1035
+ 6. All VPN traffic is forced through SmartProxy via userspace NAT with PROXY protocol v2 — no root required
1019
1036
 
1020
- ### Two Operating Modes
1037
+ ### Destination Policy
1021
1038
 
1022
- | Mode | Root Required? | How It Works |
1023
- |------|---------------|-------------|
1024
- | **TUN** (`forwardingMode: 'tun'`) | Yes | Kernel TUN device — VPN traffic enters the network stack with real VPN IPs |
1025
- | **Socket** (`forwardingMode: 'socket'`) | No | Userspace NAT via smoltcp — outbound connections send PROXY protocol v2 to preserve VPN client IPs |
1039
+ By default, VPN client traffic is redirected to localhost (SmartProxy) via `forceTarget`. You can customize this with a destination policy:
1026
1040
 
1027
- DcRouter auto-detects: if running as root, it uses TUN mode; otherwise, it falls back to socket mode. You can override this with the `forwardingMode` option.
1041
+ ```typescript
1042
+ // Default: all traffic → SmartProxy
1043
+ destinationPolicy: { default: 'forceTarget', target: '127.0.0.1' }
1044
+
1045
+ // Allow direct access to a backend subnet
1046
+ destinationPolicy: {
1047
+ default: 'forceTarget',
1048
+ target: '127.0.0.1',
1049
+ allowList: ['192.168.190.*'], // direct access to this subnet
1050
+ blockList: ['192.168.190.1'], // except the gateway
1051
+ }
1052
+
1053
+ // Block everything except specific IPs
1054
+ destinationPolicy: {
1055
+ default: 'block',
1056
+ allowList: ['10.0.0.*', '192.168.1.*'],
1057
+ }
1058
+ ```
1028
1059
 
1029
1060
  ### Configuration
1030
1061
 
@@ -1032,26 +1063,47 @@ DcRouter auto-detects: if running as root, it uses TUN mode; otherwise, it falls
1032
1063
  const router = new DcRouter({
1033
1064
  vpnConfig: {
1034
1065
  enabled: true,
1035
- subnet: '10.8.0.0/24', // VPN client IP pool (default)
1036
- wgListenPort: 51820, // WireGuard UDP port (default)
1066
+ subnet: '10.8.0.0/24', // VPN client IP pool (default)
1067
+ wgListenPort: 51820, // WireGuard UDP port (default)
1037
1068
  serverEndpoint: 'vpn.example.com', // Hostname in generated client configs
1038
- dns: ['1.1.1.1', '8.8.8.8'], // DNS servers pushed to clients
1039
- // forwardingMode: 'socket', // Override auto-detection
1069
+ dns: ['1.1.1.1', '8.8.8.8'], // DNS servers pushed to clients
1070
+
1071
+ // Pre-define VPN clients with server-defined tags
1072
+ clients: [
1073
+ { clientId: 'alice-laptop', serverDefinedClientTags: ['engineering'], description: 'Dev laptop' },
1074
+ { clientId: 'bob-phone', serverDefinedClientTags: ['engineering', 'mobile'] },
1075
+ { clientId: 'carol-desktop', serverDefinedClientTags: ['finance'] },
1076
+ ],
1077
+
1078
+ // Optional: customize destination policy (default: forceTarget → localhost)
1079
+ // destinationPolicy: { default: 'forceTarget', target: '127.0.0.1', allowList: ['192.168.1.*'] },
1040
1080
  },
1041
1081
  smartProxyConfig: {
1042
1082
  routes: [
1043
- // This route is VPN-only non-VPN clients are blocked
1083
+ // 🔐 VPN-only: any VPN client can access
1044
1084
  {
1045
- name: 'admin-panel',
1046
- match: { domains: ['admin.example.com'], ports: [443] },
1085
+ name: 'internal-app',
1086
+ match: { domains: ['internal.example.com'], ports: [443] },
1047
1087
  action: {
1048
1088
  type: 'forward',
1049
1089
  targets: [{ host: '192.168.1.50', port: 8080 }],
1050
1090
  tls: { mode: 'terminate', certificate: 'auto' },
1051
1091
  },
1052
- vpn: { required: true }, // 🔐 Only VPN clients can access this
1092
+ vpn: { required: true },
1053
1093
  },
1054
- // This route is public anyone can access it
1094
+ // 🔐 VPN + tag-restricted: only 'engineering' tagged clients
1095
+ {
1096
+ name: 'eng-dashboard',
1097
+ match: { domains: ['eng.example.com'], ports: [443] },
1098
+ action: {
1099
+ type: 'forward',
1100
+ targets: [{ host: '192.168.1.51', port: 8080 }],
1101
+ tls: { mode: 'terminate', certificate: 'auto' },
1102
+ },
1103
+ vpn: { required: true, allowedServerDefinedClientTags: ['engineering'] },
1104
+ // → alice + bob can access, carol cannot
1105
+ },
1106
+ // 🌐 Public: no VPN required
1055
1107
  {
1056
1108
  name: 'public-site',
1057
1109
  match: { domains: ['example.com'], ports: [443] },
@@ -1066,17 +1118,29 @@ const router = new DcRouter({
1066
1118
  });
1067
1119
  ```
1068
1120
 
1069
- ### Client Management via OpsServer API
1121
+ ### Client Tags
1122
+
1123
+ SmartVPN distinguishes between two types of client tags:
1124
+
1125
+ | Tag Type | Set By | Purpose |
1126
+ |----------|--------|---------|
1127
+ | `serverDefinedClientTags` | Admin (via config or API) | **Trusted** — used for route access control |
1128
+ | `clientDefinedClientTags` | Connecting client | **Informational** — displayed in dashboard, never used for security |
1129
+
1130
+ Routes with `allowedServerDefinedClientTags` only permit VPN clients whose admin-assigned tags match. Clients cannot influence their own server-defined tags.
1131
+
1132
+ ### Client Management via OpsServer
1070
1133
 
1071
- Once the VPN server is running, you can manage clients through the OpsServer dashboard or API:
1134
+ The OpsServer dashboard and API provide full VPN client lifecycle management:
1072
1135
 
1073
1136
  - **Create client** — generates WireGuard keypairs, assigns IP, returns a ready-to-use `.conf` file
1074
1137
  - **Enable / Disable** — toggle client access without deleting
1075
1138
  - **Rotate keys** — generate fresh keypairs (invalidates old ones)
1076
- - **Export config** — re-export in WireGuard or SmartVPN format
1139
+ - **Export config** — download in WireGuard (`.conf`) or SmartVPN (`.json`) format
1077
1140
  - **Telemetry** — per-client bytes sent/received, keepalives, rate limiting
1141
+ - **Delete** — remove a client and revoke access
1078
1142
 
1079
- Standard WireGuard clients on any platform (iOS, Android, macOS, Windows, Linux) can connect using the generated `.conf` file or QR code — no custom VPN software needed.
1143
+ Standard WireGuard clients on any platform (iOS, Android, macOS, Windows, Linux) can connect using the generated `.conf` file — no custom VPN software needed.
1080
1144
 
1081
1145
  ## Certificate Management
1082
1146
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '11.18.0',
6
+ version: '11.19.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  }
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '11.18.0',
6
+ version: '11.19.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  }