@push.rocks/smartvpn 1.6.0 → 1.8.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/dist_rust/{smartvpn_daemon → smartvpn_daemon_linux_amd64} +0 -0
- package/dist_rust/smartvpn_daemon_linux_arm64 +0 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/smartvpn.classes.vpnconfig.js +22 -1
- package/dist_ts/smartvpn.classes.vpnserver.d.ts +42 -1
- package/dist_ts/smartvpn.classes.vpnserver.js +65 -1
- package/dist_ts/smartvpn.interfaces.d.ts +143 -1
- package/package.json +6 -6
- package/readme.md +246 -773
- package/readme.plan.md +459 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/smartvpn.classes.vpnconfig.ts +21 -0
- package/ts/smartvpn.classes.vpnserver.ts +77 -0
- package/ts/smartvpn.interfaces.ts +100 -1
|
@@ -24,8 +24,12 @@ export type TVpnTransportOptions = IVpnTransportStdio | IVpnTransportSocket;
|
|
|
24
24
|
export interface IVpnClientConfig {
|
|
25
25
|
/** Server WebSocket URL, e.g. wss://vpn.example.com/tunnel */
|
|
26
26
|
serverUrl: string;
|
|
27
|
-
/** Server's static public key (base64) for Noise
|
|
27
|
+
/** Server's static public key (base64) for Noise IK handshake */
|
|
28
28
|
serverPublicKey: string;
|
|
29
|
+
/** Client's Noise IK private key (base64) — required for SmartVPN native transport */
|
|
30
|
+
clientPrivateKey: string;
|
|
31
|
+
/** Client's Noise IK public key (base64) — for reference/display */
|
|
32
|
+
clientPublicKey: string;
|
|
29
33
|
/** Optional DNS servers to use while connected */
|
|
30
34
|
dns?: string[];
|
|
31
35
|
/** Optional MTU for the TUN device */
|
|
@@ -96,6 +100,8 @@ export interface IVpnServerConfig {
|
|
|
96
100
|
wgListenPort?: number;
|
|
97
101
|
/** WireGuard: configured peers */
|
|
98
102
|
wgPeers?: IWgPeerConfig[];
|
|
103
|
+
/** Pre-registered clients for Noise IK authentication */
|
|
104
|
+
clients?: IClientEntry[];
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
export interface IVpnServerOptions {
|
|
@@ -146,6 +152,10 @@ export interface IVpnClientInfo {
|
|
|
146
152
|
keepalivesReceived: number;
|
|
147
153
|
rateLimitBytesPerSec?: number;
|
|
148
154
|
burstBytes?: number;
|
|
155
|
+
/** Client's authenticated Noise IK public key (base64) */
|
|
156
|
+
authenticatedKey: string;
|
|
157
|
+
/** Registered client ID from the client registry */
|
|
158
|
+
registeredClientId: string;
|
|
149
159
|
}
|
|
150
160
|
|
|
151
161
|
export interface IVpnServerStatistics extends IVpnStatistics {
|
|
@@ -205,6 +215,84 @@ export interface IVpnClientTelemetry {
|
|
|
205
215
|
burstBytes?: number;
|
|
206
216
|
}
|
|
207
217
|
|
|
218
|
+
// ============================================================================
|
|
219
|
+
// Client Registry (Hub) types — aligned with SmartProxy IRouteSecurity pattern
|
|
220
|
+
// ============================================================================
|
|
221
|
+
|
|
222
|
+
/** Per-client rate limiting. */
|
|
223
|
+
export interface IClientRateLimit {
|
|
224
|
+
/** Max throughput in bytes/sec */
|
|
225
|
+
bytesPerSec: number;
|
|
226
|
+
/** Burst allowance in bytes */
|
|
227
|
+
burstBytes: number;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Per-client security settings.
|
|
232
|
+
* Mirrors SmartProxy's IRouteSecurity: ipAllowList/ipBlockList naming + deny-overrides-allow.
|
|
233
|
+
* Adds VPN-specific destination filtering.
|
|
234
|
+
*/
|
|
235
|
+
export interface IClientSecurity {
|
|
236
|
+
/** Source IPs/CIDRs the client may connect FROM (empty = any).
|
|
237
|
+
* Supports: exact IP, CIDR, wildcard (192.168.1.*), ranges (1.1.1.1-1.1.1.5). */
|
|
238
|
+
ipAllowList?: string[];
|
|
239
|
+
/** Source IPs blocked — overrides ipAllowList (deny wins). */
|
|
240
|
+
ipBlockList?: string[];
|
|
241
|
+
/** Destination IPs/CIDRs the client may reach through the VPN (empty = all). */
|
|
242
|
+
destinationAllowList?: string[];
|
|
243
|
+
/** Destination IPs blocked — overrides destinationAllowList (deny wins). */
|
|
244
|
+
destinationBlockList?: string[];
|
|
245
|
+
/** Max concurrent connections from this client. */
|
|
246
|
+
maxConnections?: number;
|
|
247
|
+
/** Per-client rate limiting. */
|
|
248
|
+
rateLimit?: IClientRateLimit;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Server-side client definition — the central config object for the Hub.
|
|
253
|
+
* Naming and structure aligned with SmartProxy's IRouteConfig / IRouteSecurity.
|
|
254
|
+
*/
|
|
255
|
+
export interface IClientEntry {
|
|
256
|
+
/** Human-readable client ID (e.g. "alice-laptop") */
|
|
257
|
+
clientId: string;
|
|
258
|
+
/** Client's Noise IK public key (base64) — for SmartVPN native transport */
|
|
259
|
+
publicKey: string;
|
|
260
|
+
/** Client's WireGuard public key (base64) — for WireGuard transport */
|
|
261
|
+
wgPublicKey?: string;
|
|
262
|
+
/** Security settings (ACLs, rate limits) */
|
|
263
|
+
security?: IClientSecurity;
|
|
264
|
+
/** Traffic priority (lower = higher priority, default: 100) */
|
|
265
|
+
priority?: number;
|
|
266
|
+
/** Whether this client is enabled (default: true) */
|
|
267
|
+
enabled?: boolean;
|
|
268
|
+
/** Tags for grouping (e.g. ["engineering", "office"]) */
|
|
269
|
+
tags?: string[];
|
|
270
|
+
/** Optional description */
|
|
271
|
+
description?: string;
|
|
272
|
+
/** Optional expiry (ISO 8601 timestamp, omit = never expires) */
|
|
273
|
+
expiresAt?: string;
|
|
274
|
+
/** Assigned VPN IP address (set by server) */
|
|
275
|
+
assignedIp?: string;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Complete client config bundle — returned by createClient() and rotateClientKey().
|
|
280
|
+
* Contains everything the client needs to connect.
|
|
281
|
+
*/
|
|
282
|
+
export interface IClientConfigBundle {
|
|
283
|
+
/** The server-side client entry */
|
|
284
|
+
entry: IClientEntry;
|
|
285
|
+
/** Ready-to-use SmartVPN client config (typed object) */
|
|
286
|
+
smartvpnConfig: IVpnClientConfig;
|
|
287
|
+
/** Ready-to-use WireGuard .conf file content (string) */
|
|
288
|
+
wireguardConfig: string;
|
|
289
|
+
/** Client's private keys (ONLY returned at creation time, not stored server-side) */
|
|
290
|
+
secrets: {
|
|
291
|
+
noisePrivateKey: string;
|
|
292
|
+
wgPrivateKey: string;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
208
296
|
// ============================================================================
|
|
209
297
|
// WireGuard-specific types
|
|
210
298
|
// ============================================================================
|
|
@@ -262,6 +350,17 @@ export type TVpnServerCommands = {
|
|
|
262
350
|
addWgPeer: { params: { peer: IWgPeerConfig }; result: void };
|
|
263
351
|
removeWgPeer: { params: { publicKey: string }; result: void };
|
|
264
352
|
listWgPeers: { params: Record<string, never>; result: { peers: IWgPeerInfo[] } };
|
|
353
|
+
// Client Registry (Hub) commands
|
|
354
|
+
createClient: { params: { client: Partial<IClientEntry> }; result: IClientConfigBundle };
|
|
355
|
+
removeClient: { params: { clientId: string }; result: void };
|
|
356
|
+
getClient: { params: { clientId: string }; result: IClientEntry };
|
|
357
|
+
listRegisteredClients: { params: Record<string, never>; result: { clients: IClientEntry[] } };
|
|
358
|
+
updateClient: { params: { clientId: string; update: Partial<IClientEntry> }; result: void };
|
|
359
|
+
enableClient: { params: { clientId: string }; result: void };
|
|
360
|
+
disableClient: { params: { clientId: string }; result: void };
|
|
361
|
+
rotateClientKey: { params: { clientId: string }; result: IClientConfigBundle };
|
|
362
|
+
exportClientConfig: { params: { clientId: string; format: 'smartvpn' | 'wireguard' }; result: { config: string } };
|
|
363
|
+
generateClientKeypair: { params: Record<string, never>; result: IVpnKeypair };
|
|
265
364
|
};
|
|
266
365
|
|
|
267
366
|
// ============================================================================
|