@push.rocks/smartproxy 25.14.0 → 25.15.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 +14 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/package.json +10 -9
- package/readme.md +178 -33
- package/ts/00_commitinfo_data.ts +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-03-19 - 25.15.0 - feat(readme)
|
|
4
|
+
document UDP, QUIC, and HTTP/3 support in the README
|
|
5
|
+
|
|
6
|
+
- Adds README examples for UDP datagram handlers, QUIC/HTTP3 forwarding, and dual-stack TCP/UDP routes
|
|
7
|
+
- Expands configuration and API reference sections to cover transport matching, UDP/QUIC options, backend transport selection, and UDP metrics
|
|
8
|
+
- Updates architecture and feature descriptions to reflect UDP, QUIC, HTTP/3, and datagram handler capabilities
|
|
9
|
+
|
|
10
|
+
## 2026-03-19 - 25.14.1 - fix(deps)
|
|
11
|
+
update build and runtime dependencies and align route validation test expectations
|
|
12
|
+
|
|
13
|
+
- split the test preparation step into a dedicated test:before script while keeping test execution separate
|
|
14
|
+
- bump development tooling and runtime package versions in package.json
|
|
15
|
+
- adjust the route validation test to match the current generic handler error message
|
|
16
|
+
|
|
3
17
|
## 2026-03-19 - 25.14.0 - feat(udp,http3)
|
|
4
18
|
add UDP datagram handler relay support and stream HTTP/3 request bodies to backends
|
|
5
19
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartproxy',
|
|
6
|
-
version: '25.
|
|
6
|
+
version: '25.15.0',
|
|
7
7
|
description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFNBQVM7SUFDbEIsV0FBVyxFQUFFLHFQQUFxUDtDQUNuUSxDQUFBIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@push.rocks/smartproxy",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
|
@@ -9,27 +9,28 @@
|
|
|
9
9
|
"author": "Lossless GmbH",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "(tsrust)
|
|
12
|
+
"test:before": "(tsrust)",
|
|
13
|
+
"test": "(tstest test/**/test*.ts --verbose --timeout 60 --logfile)",
|
|
13
14
|
"build": "(tsbuild tsfolders --allowimplicitany) && (tsrust)",
|
|
14
15
|
"format": "(gitzone format)",
|
|
15
16
|
"buildDocs": "tsdoc"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@git.zone/tsbuild": "^4.
|
|
19
|
+
"@git.zone/tsbuild": "^4.3.0",
|
|
19
20
|
"@git.zone/tsrun": "^2.0.1",
|
|
20
21
|
"@git.zone/tsrust": "^1.3.0",
|
|
21
|
-
"@git.zone/tstest": "^3.
|
|
22
|
+
"@git.zone/tstest": "^3.5.0",
|
|
22
23
|
"@push.rocks/smartserve": "^2.0.1",
|
|
23
|
-
"@types/node": "^25.
|
|
24
|
+
"@types/node": "^25.5.0",
|
|
24
25
|
"typescript": "^5.9.3",
|
|
25
26
|
"why-is-node-running": "^3.2.2"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@push.rocks/smartcrypto": "^2.0.4",
|
|
29
|
-
"@push.rocks/smartlog": "^3.1
|
|
30
|
-
"@push.rocks/smartrust": "^1.2
|
|
31
|
-
"@tsclass/tsclass": "^9.
|
|
32
|
-
"minimatch": "^10.2.
|
|
30
|
+
"@push.rocks/smartlog": "^3.2.1",
|
|
31
|
+
"@push.rocks/smartrust": "^1.3.2",
|
|
32
|
+
"@tsclass/tsclass": "^9.5.0",
|
|
33
|
+
"minimatch": "^10.2.4"
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
36
|
"ts/**/*",
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @push.rocks/smartproxy 🚀
|
|
2
2
|
|
|
3
|
-
**A high-performance, Rust-powered proxy toolkit for Node.js** — unified route-based configuration for SSL/TLS termination, HTTP/HTTPS reverse proxying, WebSocket support, load balancing, custom protocol handlers, and kernel-level NFTables forwarding.
|
|
3
|
+
**A high-performance, Rust-powered proxy toolkit for Node.js** — unified route-based configuration for SSL/TLS termination, HTTP/HTTPS reverse proxying, WebSocket support, UDP/QUIC/HTTP3, load balancing, custom protocol handlers, and kernel-level NFTables forwarding.
|
|
4
4
|
|
|
5
5
|
## 📦 Installation
|
|
6
6
|
|
|
@@ -16,9 +16,9 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
|
|
|
16
16
|
|
|
17
17
|
## 🎯 What is SmartProxy?
|
|
18
18
|
|
|
19
|
-
SmartProxy is a production-ready proxy solution that takes the complexity out of traffic management. Under the hood, all networking — TCP, TLS, HTTP reverse proxy, connection tracking, security enforcement, and NFTables — is handled by a **Rust engine** for maximum performance, while you configure everything through a clean TypeScript API with full type safety.
|
|
19
|
+
SmartProxy is a production-ready proxy solution that takes the complexity out of traffic management. Under the hood, all networking — TCP, UDP, TLS, HTTP reverse proxy, QUIC/HTTP3, connection tracking, security enforcement, and NFTables — is handled by a **Rust engine** for maximum performance, while you configure everything through a clean TypeScript API with full type safety.
|
|
20
20
|
|
|
21
|
-
Whether you're building microservices, deploying edge infrastructure, or need a battle-tested reverse proxy with automatic Let's Encrypt certificates, SmartProxy has you covered.
|
|
21
|
+
Whether you're building microservices, deploying edge infrastructure, proxying UDP-based protocols, or need a battle-tested reverse proxy with automatic Let's Encrypt certificates, SmartProxy has you covered.
|
|
22
22
|
|
|
23
23
|
### ⚡ Key Features
|
|
24
24
|
|
|
@@ -29,11 +29,12 @@ Whether you're building microservices, deploying edge infrastructure, or need a
|
|
|
29
29
|
| 🔒 **Automatic SSL/TLS** | Zero-config HTTPS with Let's Encrypt ACME integration |
|
|
30
30
|
| 🎯 **Flexible Matching** | Route by port, domain, path, protocol, client IP, TLS version, headers, or custom logic |
|
|
31
31
|
| 🚄 **High-Performance** | Choose between user-space or kernel-level (NFTables) forwarding |
|
|
32
|
+
| 📡 **UDP & QUIC/HTTP3** | First-class UDP transport, datagram handlers, QUIC tunneling, and HTTP/3 support |
|
|
32
33
|
| ⚖️ **Load Balancing** | Round-robin, least-connections, IP-hash with health checks |
|
|
33
34
|
| 🛡️ **Enterprise Security** | IP filtering, rate limiting, basic auth, JWT auth, connection limits |
|
|
34
35
|
| 🔌 **WebSocket Support** | First-class WebSocket proxying with ping/pong keep-alive |
|
|
35
|
-
| 🎮 **Custom Protocols** | Socket handlers for implementing any protocol in TypeScript |
|
|
36
|
-
| 📊 **Live Metrics** | Real-time throughput, connection counts, and performance data |
|
|
36
|
+
| 🎮 **Custom Protocols** | Socket and datagram handlers for implementing any protocol in TypeScript |
|
|
37
|
+
| 📊 **Live Metrics** | Real-time throughput, connection counts, UDP sessions, and performance data |
|
|
37
38
|
| 🔧 **Dynamic Management** | Add/remove ports and routes at runtime without restarts |
|
|
38
39
|
| 🔄 **PROXY Protocol** | Full PROXY protocol v1/v2 support for preserving client information |
|
|
39
40
|
| 💾 **Consumer Cert Storage** | Bring your own persistence — SmartProxy never writes certs to disk |
|
|
@@ -89,7 +90,7 @@ SmartProxy uses a powerful **match/action** pattern that makes routing predictab
|
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
Every route consists of:
|
|
92
|
-
- **Match** — What traffic to capture (ports, domains, paths, protocol, IPs, headers)
|
|
93
|
+
- **Match** — What traffic to capture (ports, domains, paths, transport, protocol, IPs, headers)
|
|
93
94
|
- **Action** — What to do with it (`forward` or `socket-handler`)
|
|
94
95
|
- **Security** (optional) — IP allow/block lists, rate limits, authentication
|
|
95
96
|
- **Headers** (optional) — Request/response header manipulation with template variables
|
|
@@ -197,7 +198,7 @@ apiRoute = addRateLimiting(apiRoute, {
|
|
|
197
198
|
const proxy = new SmartProxy({ routes: [apiRoute] });
|
|
198
199
|
```
|
|
199
200
|
|
|
200
|
-
### 🎮 Custom Protocol Handler
|
|
201
|
+
### 🎮 Custom Protocol Handler (TCP)
|
|
201
202
|
|
|
202
203
|
SmartProxy lets you implement any protocol with full socket control. Routes with JavaScript socket handlers are automatically relayed from the Rust engine back to your TypeScript code:
|
|
203
204
|
|
|
@@ -247,6 +248,98 @@ const proxy = new SmartProxy({ routes: [echoRoute, customRoute] });
|
|
|
247
248
|
| `SocketHandlers.httpBlock(status, message)` | HTTP block response |
|
|
248
249
|
| `SocketHandlers.block(message)` | Block with optional message |
|
|
249
250
|
|
|
251
|
+
### 📡 UDP Datagram Handler
|
|
252
|
+
|
|
253
|
+
Handle raw UDP datagrams with custom TypeScript logic — perfect for DNS, game servers, IoT protocols, or any UDP-based service:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import { SmartProxy } from '@push.rocks/smartproxy';
|
|
257
|
+
import type { IRouteConfig, TDatagramHandler, IDatagramInfo } from '@push.rocks/smartproxy';
|
|
258
|
+
|
|
259
|
+
// Custom UDP echo handler
|
|
260
|
+
const udpHandler: TDatagramHandler = (datagram, info, reply) => {
|
|
261
|
+
console.log(`UDP from ${info.sourceIp}:${info.sourcePort} on port ${info.destPort}`);
|
|
262
|
+
reply(datagram); // Echo it back
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const proxy = new SmartProxy({
|
|
266
|
+
routes: [{
|
|
267
|
+
name: 'udp-echo',
|
|
268
|
+
match: {
|
|
269
|
+
ports: 5353,
|
|
270
|
+
transport: 'udp' // 👈 Listen for UDP datagrams
|
|
271
|
+
},
|
|
272
|
+
action: {
|
|
273
|
+
type: 'socket-handler',
|
|
274
|
+
datagramHandler: udpHandler, // 👈 Process each datagram
|
|
275
|
+
udp: {
|
|
276
|
+
sessionTimeout: 60000, // Session idle timeout (ms)
|
|
277
|
+
maxSessionsPerIP: 100,
|
|
278
|
+
maxDatagramSize: 65535
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}]
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
await proxy.start();
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### 📡 QUIC / HTTP3 Forwarding
|
|
288
|
+
|
|
289
|
+
Forward QUIC traffic to backends with optional protocol translation (e.g., receive QUIC, forward as TCP/HTTP1):
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
import { SmartProxy } from '@push.rocks/smartproxy';
|
|
293
|
+
import type { IRouteConfig } from '@push.rocks/smartproxy';
|
|
294
|
+
|
|
295
|
+
const quicRoute: IRouteConfig = {
|
|
296
|
+
name: 'quic-to-backend',
|
|
297
|
+
match: {
|
|
298
|
+
ports: 443,
|
|
299
|
+
transport: 'udp',
|
|
300
|
+
protocol: 'quic' // 👈 Match QUIC protocol
|
|
301
|
+
},
|
|
302
|
+
action: {
|
|
303
|
+
type: 'forward',
|
|
304
|
+
targets: [{
|
|
305
|
+
host: 'backend-server',
|
|
306
|
+
port: 8443,
|
|
307
|
+
backendTransport: 'tcp' // 👈 Translate QUIC → TCP for backend
|
|
308
|
+
}],
|
|
309
|
+
udp: {
|
|
310
|
+
quic: {
|
|
311
|
+
enableHttp3: true,
|
|
312
|
+
maxIdleTimeout: 30000,
|
|
313
|
+
maxConcurrentBidiStreams: 100,
|
|
314
|
+
altSvcPort: 443, // Advertise in Alt-Svc header
|
|
315
|
+
altSvcMaxAge: 86400
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const proxy = new SmartProxy({ routes: [quicRoute] });
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### 🔁 Dual-Stack TCP + UDP Route
|
|
325
|
+
|
|
326
|
+
Listen on both TCP and UDP with a single route — handle each transport with its own handler:
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
const dualStackRoute: IRouteConfig = {
|
|
330
|
+
name: 'dual-stack-dns',
|
|
331
|
+
match: {
|
|
332
|
+
ports: 53,
|
|
333
|
+
transport: 'all' // 👈 Listen on both TCP and UDP
|
|
334
|
+
},
|
|
335
|
+
action: {
|
|
336
|
+
type: 'socket-handler',
|
|
337
|
+
socketHandler: handleTcpDns, // 👈 TCP connections
|
|
338
|
+
datagramHandler: handleUdpDns, // 👈 UDP datagrams
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
```
|
|
342
|
+
|
|
250
343
|
### ⚡ High-Performance NFTables Forwarding
|
|
251
344
|
|
|
252
345
|
For ultra-low latency on Linux, use kernel-level forwarding (requires root):
|
|
@@ -419,6 +512,10 @@ console.log(`Bytes in: ${metrics.totals.bytesIn()}`);
|
|
|
419
512
|
console.log(`Requests/sec: ${metrics.requests.perSecond()}`);
|
|
420
513
|
console.log(`Throughput in: ${metrics.throughput.instant().in} bytes/sec`);
|
|
421
514
|
|
|
515
|
+
// UDP metrics
|
|
516
|
+
console.log(`UDP sessions: ${metrics.udp.activeSessions()}`);
|
|
517
|
+
console.log(`Datagrams in: ${metrics.udp.datagramsIn()}`);
|
|
518
|
+
|
|
422
519
|
// Get detailed statistics from the Rust engine
|
|
423
520
|
const stats = await proxy.getStatistics();
|
|
424
521
|
|
|
@@ -545,7 +642,7 @@ SmartProxy uses a hybrid **Rust + TypeScript** architecture:
|
|
|
545
642
|
```
|
|
546
643
|
┌─────────────────────────────────────────────────────┐
|
|
547
644
|
│ Your Application │
|
|
548
|
-
│ (TypeScript — routes, config,
|
|
645
|
+
│ (TypeScript — routes, config, handlers) │
|
|
549
646
|
└──────────────────┬──────────────────────────────────┘
|
|
550
647
|
│ IPC (JSON over stdin/stdout)
|
|
551
648
|
┌──────────────────▼──────────────────────────────────┐
|
|
@@ -556,22 +653,23 @@ SmartProxy uses a hybrid **Rust + TypeScript** architecture:
|
|
|
556
653
|
│ │ │ │ Proxy │ │ │ │ │ │
|
|
557
654
|
│ └─────────┘ └─────────┘ └─────────┘ └──────────┘ │
|
|
558
655
|
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐ │
|
|
559
|
-
│ │ Security│ │ Metrics │ │
|
|
560
|
-
│ │ Enforce │ │ Collect │ │
|
|
561
|
-
│ │
|
|
656
|
+
│ │ UDP │ │ Security│ │ Metrics │ │ NFTables │ │
|
|
657
|
+
│ │ QUIC │ │ Enforce │ │ Collect │ │ Mgr │ │
|
|
658
|
+
│ │ HTTP/3 │ │ │ │ │ │ │ │
|
|
562
659
|
│ └─────────┘ └─────────┘ └─────────┘ └──────────┘ │
|
|
563
660
|
└──────────────────┬──────────────────────────────────┘
|
|
564
661
|
│ Unix Socket Relay
|
|
565
662
|
┌──────────────────▼──────────────────────────────────┐
|
|
566
|
-
│
|
|
567
|
-
│ (for JS
|
|
663
|
+
│ TypeScript Socket & Datagram Handler Servers │
|
|
664
|
+
│ (for JS socket handlers, datagram handlers, │
|
|
665
|
+
│ and dynamic routes) │
|
|
568
666
|
└─────────────────────────────────────────────────────┘
|
|
569
667
|
```
|
|
570
668
|
|
|
571
|
-
- **Rust Engine** handles all networking, TLS, HTTP proxying, connection management, security, and metrics
|
|
572
|
-
- **TypeScript** provides the npm API, configuration types, route helpers, validation, and
|
|
669
|
+
- **Rust Engine** handles all networking: TCP, UDP, TLS, QUIC, HTTP proxying, connection management, security, and metrics
|
|
670
|
+
- **TypeScript** provides the npm API, configuration types, route helpers, validation, and handler callbacks
|
|
573
671
|
- **IPC** — The TypeScript wrapper uses JSON commands/events over stdin/stdout to communicate with the Rust binary
|
|
574
|
-
- **Socket Relay** —
|
|
672
|
+
- **Socket/Datagram Relay** — Unix domain socket servers for routes requiring TypeScript-side handling (socket handlers, datagram handlers, dynamic host/port functions)
|
|
575
673
|
|
|
576
674
|
## 🎯 Route Configuration Reference
|
|
577
675
|
|
|
@@ -579,22 +677,26 @@ SmartProxy uses a hybrid **Rust + TypeScript** architecture:
|
|
|
579
677
|
|
|
580
678
|
```typescript
|
|
581
679
|
interface IRouteMatch {
|
|
582
|
-
ports:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
680
|
+
ports: TPortRange; // Required — port(s) to listen on
|
|
681
|
+
transport?: 'tcp' | 'udp' | 'all'; // Transport protocol (default: 'tcp')
|
|
682
|
+
domains?: string | string[]; // 'example.com', '*.example.com'
|
|
683
|
+
path?: string; // '/api/*', '/users/:id'
|
|
684
|
+
clientIp?: string[]; // ['10.0.0.0/8', '192.168.*']
|
|
685
|
+
tlsVersion?: string[]; // ['TLSv1.2', 'TLSv1.3']
|
|
587
686
|
headers?: Record<string, string | RegExp>; // Match by HTTP headers
|
|
588
|
-
protocol?: 'http' | 'tcp'
|
|
687
|
+
protocol?: 'http' | 'tcp' | 'udp' | 'quic' | 'http3'; // Application-layer protocol
|
|
589
688
|
}
|
|
689
|
+
|
|
690
|
+
// Port range supports single numbers, arrays, and ranges
|
|
691
|
+
type TPortRange = number | Array<number | { from: number; to: number }>;
|
|
590
692
|
```
|
|
591
693
|
|
|
592
694
|
### Action Types
|
|
593
695
|
|
|
594
696
|
| Type | Description |
|
|
595
697
|
|------|-------------|
|
|
596
|
-
| `forward` | Proxy to one or more backend targets (with optional TLS, WebSocket, load balancing) |
|
|
597
|
-
| `socket-handler` | Custom socket handling function in TypeScript |
|
|
698
|
+
| `forward` | Proxy to one or more backend targets (with optional TLS, WebSocket, load balancing, UDP/QUIC) |
|
|
699
|
+
| `socket-handler` | Custom socket/datagram handling function in TypeScript |
|
|
598
700
|
|
|
599
701
|
### Target Options
|
|
600
702
|
|
|
@@ -602,14 +704,15 @@ interface IRouteMatch {
|
|
|
602
704
|
interface IRouteTarget {
|
|
603
705
|
host: string | string[] | ((context: IRouteContext) => string | string[]);
|
|
604
706
|
port: number | 'preserve' | ((context: IRouteContext) => number);
|
|
605
|
-
tls?: IRouteTls;
|
|
606
|
-
priority?: number;
|
|
607
|
-
match?: ITargetMatch;
|
|
707
|
+
tls?: IRouteTls; // Per-target TLS override
|
|
708
|
+
priority?: number; // Target priority
|
|
709
|
+
match?: ITargetMatch; // Sub-match within a route (by port, path, headers, method)
|
|
608
710
|
websocket?: IRouteWebSocket;
|
|
609
711
|
loadBalancing?: IRouteLoadBalancing;
|
|
610
712
|
sendProxyProtocol?: boolean;
|
|
611
713
|
headers?: IRouteHeaders;
|
|
612
714
|
advanced?: IRouteAdvanced;
|
|
715
|
+
backendTransport?: 'tcp' | 'udp'; // Backend transport (e.g., receive QUIC, forward as TCP)
|
|
613
716
|
}
|
|
614
717
|
```
|
|
615
718
|
|
|
@@ -666,6 +769,27 @@ interface IRouteLoadBalancing {
|
|
|
666
769
|
}
|
|
667
770
|
```
|
|
668
771
|
|
|
772
|
+
### UDP & QUIC Options
|
|
773
|
+
|
|
774
|
+
```typescript
|
|
775
|
+
interface IRouteUdp {
|
|
776
|
+
sessionTimeout?: number; // Idle timeout per UDP session (ms, default: 60000)
|
|
777
|
+
maxSessionsPerIP?: number; // Max concurrent sessions per IP (default: 1000)
|
|
778
|
+
maxDatagramSize?: number; // Max datagram size in bytes (default: 65535)
|
|
779
|
+
quic?: IRouteQuic;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
interface IRouteQuic {
|
|
783
|
+
maxIdleTimeout?: number; // QUIC idle timeout (ms, default: 30000)
|
|
784
|
+
maxConcurrentBidiStreams?: number; // Max bidi streams (default: 100)
|
|
785
|
+
maxConcurrentUniStreams?: number; // Max uni streams (default: 100)
|
|
786
|
+
enableHttp3?: boolean; // Enable HTTP/3 (default: false)
|
|
787
|
+
altSvcPort?: number; // Port for Alt-Svc header
|
|
788
|
+
altSvcMaxAge?: number; // Alt-Svc max age in seconds (default: 86400)
|
|
789
|
+
initialCongestionWindow?: number; // Initial congestion window (bytes)
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
669
793
|
## 🛠️ Helper Functions Reference
|
|
670
794
|
|
|
671
795
|
All helpers are fully typed and return `IRouteConfig` or `IRouteConfig[]`:
|
|
@@ -689,7 +813,7 @@ import {
|
|
|
689
813
|
createWebSocketRoute, // WebSocket-enabled route
|
|
690
814
|
|
|
691
815
|
// Custom Protocols
|
|
692
|
-
createSocketHandlerRoute, // Custom socket handler
|
|
816
|
+
createSocketHandlerRoute, // Custom TCP socket handler
|
|
693
817
|
SocketHandlers, // Pre-built handlers (echo, proxy, block, etc.)
|
|
694
818
|
|
|
695
819
|
// NFTables (Linux, requires root)
|
|
@@ -718,6 +842,8 @@ import {
|
|
|
718
842
|
} from '@push.rocks/smartproxy';
|
|
719
843
|
```
|
|
720
844
|
|
|
845
|
+
> **Tip:** For UDP datagram handler routes or QUIC/HTTP3 routes, construct `IRouteConfig` objects directly — there are no helper functions for these yet. See the [UDP Datagram Handler](#-udp-datagram-handler) and [QUIC / HTTP3 Forwarding](#-quic--http3-forwarding) examples above.
|
|
846
|
+
|
|
721
847
|
## 📖 API Documentation
|
|
722
848
|
|
|
723
849
|
### SmartProxy Class
|
|
@@ -753,6 +879,8 @@ class SmartProxy extends EventEmitter {
|
|
|
753
879
|
|
|
754
880
|
// Events
|
|
755
881
|
on(event: 'error', handler: (err: Error) => void): this;
|
|
882
|
+
on(event: 'certificate-issued', handler: (ev: ICertificateIssuedEvent) => void): this;
|
|
883
|
+
on(event: 'certificate-failed', handler: (ev: ICertificateFailedEvent) => void): this;
|
|
756
884
|
}
|
|
757
885
|
```
|
|
758
886
|
|
|
@@ -775,6 +903,8 @@ interface ISmartProxyOptions {
|
|
|
775
903
|
// Custom certificate provisioning
|
|
776
904
|
certProvisionFunction?: (domain: string) => Promise<ICert | 'http01'>;
|
|
777
905
|
certProvisionFallbackToAcme?: boolean; // Fall back to ACME on failure (default: true)
|
|
906
|
+
certProvisionTimeout?: number; // Timeout per provision call (ms)
|
|
907
|
+
certProvisionConcurrency?: number; // Max concurrent provisions
|
|
778
908
|
|
|
779
909
|
// Consumer-managed certificate persistence (see "Consumer-Managed Certificate Storage")
|
|
780
910
|
certStore?: ISmartProxyCertStore;
|
|
@@ -782,6 +912,9 @@ interface ISmartProxyOptions {
|
|
|
782
912
|
// Self-signed fallback
|
|
783
913
|
disableDefaultCert?: boolean; // Disable '*' self-signed fallback (default: false)
|
|
784
914
|
|
|
915
|
+
// Rust binary path override
|
|
916
|
+
rustBinaryPath?: string; // Custom path to the Rust proxy binary
|
|
917
|
+
|
|
785
918
|
// Global defaults
|
|
786
919
|
defaults?: {
|
|
787
920
|
target?: { host: string; port: number };
|
|
@@ -868,11 +1001,22 @@ metrics.requests.perSecond(); // Requests per second
|
|
|
868
1001
|
metrics.requests.perMinute(); // Requests per minute
|
|
869
1002
|
metrics.requests.total(); // Total requests
|
|
870
1003
|
|
|
1004
|
+
// UDP metrics
|
|
1005
|
+
metrics.udp.activeSessions(); // Current active UDP sessions
|
|
1006
|
+
metrics.udp.totalSessions(); // Total UDP sessions since start
|
|
1007
|
+
metrics.udp.datagramsIn(); // Datagrams received
|
|
1008
|
+
metrics.udp.datagramsOut(); // Datagrams sent
|
|
1009
|
+
|
|
871
1010
|
// Cumulative totals
|
|
872
1011
|
metrics.totals.bytesIn(); // Total bytes received
|
|
873
1012
|
metrics.totals.bytesOut(); // Total bytes sent
|
|
874
1013
|
metrics.totals.connections(); // Total connections
|
|
875
1014
|
|
|
1015
|
+
// Backend metrics
|
|
1016
|
+
metrics.backends.byBackend(); // Map<backend, IBackendMetrics>
|
|
1017
|
+
metrics.backends.protocols(); // Map<backend, protocol>
|
|
1018
|
+
metrics.backends.topByErrors(10); // Top N error-prone backends
|
|
1019
|
+
|
|
876
1020
|
// Percentiles
|
|
877
1021
|
metrics.percentiles.connectionDuration(); // { p50, p95, p99 }
|
|
878
1022
|
metrics.percentiles.bytesTransferred(); // { in: { p50, p95, p99 }, out: { p50, p95, p99 } }
|
|
@@ -896,11 +1040,12 @@ metrics.percentiles.bytesTransferred(); // { in: { p50, p95, p99 }, out: { p5
|
|
|
896
1040
|
### Rust Binary Not Found
|
|
897
1041
|
|
|
898
1042
|
SmartProxy searches for the Rust binary in this order:
|
|
899
|
-
1. `
|
|
900
|
-
2.
|
|
901
|
-
3.
|
|
902
|
-
4.
|
|
903
|
-
5.
|
|
1043
|
+
1. `rustBinaryPath` option in `ISmartProxyOptions`
|
|
1044
|
+
2. `SMARTPROXY_RUST_BINARY` environment variable
|
|
1045
|
+
3. Platform-specific npm package (`@push.rocks/smartproxy-linux-x64`, etc.)
|
|
1046
|
+
4. `dist_rust/rustproxy` relative to the package root (built by `tsrust`)
|
|
1047
|
+
5. Local dev build (`./rust/target/release/rustproxy`)
|
|
1048
|
+
6. System PATH (`rustproxy`)
|
|
904
1049
|
|
|
905
1050
|
### Performance Tuning
|
|
906
1051
|
- ✅ Use NFTables forwarding for high-traffic routes (Linux only)
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartproxy',
|
|
6
|
-
version: '25.
|
|
6
|
+
version: '25.15.0',
|
|
7
7
|
description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.'
|
|
8
8
|
}
|