@push.rocks/smartproxy 20.0.0 → 21.0.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 ADDED
@@ -0,0 +1,159 @@
1
+ # Changelog
2
+
3
+ ## 2025-07-22 - 21.0.0 - BREAKING_CHANGE(forwarding)
4
+ Remove legacy forwarding module
5
+
6
+ - Removed the `forwarding` namespace export from main index
7
+ - Removed TForwardingType and all forwarding handlers
8
+ - Consolidated route helper functions into route-helpers.ts
9
+ - All functionality is now available through the route-based system
10
+ - MIGRATION: Replace `import { forwarding } from '@push.rocks/smartproxy'` with direct imports of route helpers
11
+
12
+ ## 2025-07-21 - 20.0.2 - fix(docs)
13
+ Update documentation to improve clarity
14
+
15
+ - Enhanced readme with clearer breaking change warning for v20.0.0
16
+ - Fixed example email address from ssl@bleu.de to ssl@example.com
17
+ - Added load balancing and failover features to feature list
18
+ - Improved documentation structure and examples
19
+
20
+ ## 2025-07-20 - 20.0.1 - BREAKING_CHANGE(routing)
21
+ Refactor route configuration to support multiple targets
22
+
23
+ - Changed route action configuration from single `target` to `targets` array
24
+ - Enables load balancing and failover capabilities with multiple upstream targets
25
+ - Updated all test files to use new `targets` array syntax
26
+ - Automatic certificate metadata refresh
27
+
28
+ ## 2025-06-01 - 19.5.19 - fix(smartproxy)
29
+ Fix connection handling and improve route matching edge cases
30
+
31
+ - Enhanced cleanup logic to prevent connection accumulation under rapid retry scenarios
32
+ - Improved matching for wildcard domains and path parameters in the route configuration
33
+ - Minor refactoring in async utilities and internal socket handling for better performance
34
+ - Updated test suites and documentation for clearer configuration examples
35
+
36
+ ## 2025-05-29 - 19.5.3 - fix(smartproxy)
37
+ Fix route security configuration location and improve ACME timing tests and socket mock implementations
38
+
39
+ - Move route security from action.security to the top-level route.security to correctly enforce IP allow/block lists (addresses failing in test.route-security.ts)
40
+ - Update readme.problems.md to document the routing security configuration issue with proper instructions
41
+ - Adjust certificate metadata in certs/static-route/meta.json with updated timestamps
42
+ - Update test.acme-timing.ts to export default tap.start() instead of tap.start() to ensure proper parsing
43
+ - Improve socket simulation and event handling mocks in test.http-fix-verification.ts and test.http-forwarding-fix.ts to more reliably mimic net.Socket behavior
44
+ - Minor adjustments in multiple test files to ensure proper port binding, race condition handling and route lookups (e.g. getRoutesForPort implementation)
45
+
46
+ ## 2025-05-29 - 19.5.2 - fix(test)
47
+ Fix ACME challenge route creation and HTTP request parsing in tests
48
+
49
+ - Replaced the legacy ACME email 'test@example.com' with 'test@acmetest.local' to avoid forbidden domain issues.
50
+ - Mocked the CertificateManager in test/test.acme-route-creation to simulate immediate ACME challenge route addition.
51
+ - Adjusted updateRoutes callback to capture and verify challenge route creation.
52
+ - Enhanced the HTTP request parsing in socket handler by capturing and asserting parsed request details (method, path, headers).
53
+
54
+ ## 2025-05-29 - 19.5.1 - fix(socket-handler)
55
+ Fix socket handler race condition by differentiating between async and sync handlers. Now, async socket handlers complete their setup before initial data is emitted, ensuring that no data is lost. Documentation and tests have been updated to reflect this change.
56
+
57
+ - Added detailed explanation in readme.hints.md about the race condition issue, root cause, and solution implementation.
58
+ - Provided a code snippet that checks if the socket handler returns a Promise and waits for its resolution before emitting initial data.
59
+ - Updated tests (test.socket-handler-race.ts, test.socket-handler.simple.ts, test.socket-handler.ts) to verify correct behavior of async handlers.
60
+
61
+ ## 2025-05-28 - 19.5.0 - feat(socket-handler)
62
+ Add socket-handler support for custom socket handling in SmartProxy
63
+
64
+ - Introduce new action type 'socket-handler' in IRouteAction to allow users to provide a custom socket handler function.
65
+ - Update the RouteConnectionHandler to detect 'socket-handler' actions and invoke the handler with the raw socket, giving full control to the user.
66
+ - Provide optional context (such as route configuration, client IP, and port) to the socket handler if needed.
67
+ - Add helper functions in route-helpers for creating socket handler routes and common patterns like echo, proxy, and line-based protocols.
68
+ - Include a detailed implementation plan and usage examples in readme.plan.md.
69
+
70
+ ## 2025-05-28 - 19.4.3 - fix(smartproxy)
71
+ Improve port binding intelligence and ACME challenge route management; update route configuration tests and dependency versions.
72
+
73
+ - Bumped dev dependency versions in package.json (tsbuild from ^2.5.1 to ^2.6.4, tstest from ^1.9.0 to ^2.3.1, @types/node updated, smartfile from ^11.2.0 to ^11.2.5, smartlog from ^3.1.7 to ^3.1.8)
74
+ - Removed readme.plan.md containing legacy development plan information
75
+ - Normalized route configuration properties across tests (using 'ports' and 'domains' instead of legacy 'port' or 'domain')
76
+ - Enhanced PortManager with reference counting and smarter port conflict detection to avoid redundant bindings
77
+ - Refined ACME challenge route integration to merge with existing port bindings and improve error handling
78
+ - Adjusted test expectations (e.g. using toEqual instead of toBe, and improved timeout handling) to align with current API changes
79
+
80
+ ## 2025-05-20 - 19.4.2 - fix(dependencies)
81
+ Update dependency versions: upgrade @types/node to ^22.15.20 and @push.rocks/smartlog to ^3.1.7 in package.json
82
+
83
+ - Bump @types/node from ^22.15.19 to ^22.15.20
84
+ - Bump @push.rocks/smartlog from ^3.1.3 to ^3.1.7
85
+
86
+ ## 2025-05-20 - 19.4.1 - fix(smartproxy)
87
+ Bump @push.rocks/smartlog to ^3.1.3 and improve ACME port binding behavior in SmartProxy
88
+
89
+ - Updated package.json to use @push.rocks/smartlog version ^3.1.3
90
+ - Enhanced tests (test.http-port8080-simple.ts) to verify improved port binding intelligence for ACME challenge routes
91
+ - Ensured that existing port listeners are reused and not re-bound when updating routes
92
+
93
+ ## 2025-05-20 - 19.4.0 - feat(certificate-manager, smart-proxy)
94
+ Improve port binding intelligence for ACME challenges
95
+
96
+ - Reordered SmartProxy initialization flow to bind ports before initializing the certificate manager
97
+ - Enhanced port binding logic to better handle ACME challenge routes
98
+ - Improved error detection and reporting for port binding conflicts
99
+ - Added better diagnostics for ACME challenge port issues
100
+ - Made route updates more intelligent with detailed port tracking
101
+ - Fixed race condition where ACME routes were added before port 80 was bound
102
+ - Added special handling for ACME port conflicts with improved error messages
103
+
104
+ ## 2025-05-20 - 19.3.14 - fix(certificate-manager, smart-proxy)
105
+ Add error handling around logger calls in route update callback
106
+
107
+ - Added try/catch blocks around logger calls in certificate-manager.ts
108
+ - Added try/catch blocks around logger calls in smart-proxy.ts related to route updates
109
+ - Provided fallback to console.log when logger fails
110
+ - Ensured core route update functionality continues to work even if logging fails
111
+
112
+ ## 2025-05-20 - 19.3.13 - fix(port-manager, certificate-manager)
113
+ Improve port binding and ACME challenge route integration in SmartProxy
114
+
115
+ - Added reference counting in PortManager so that routes sharing the same port reuse the existing binding.
116
+ - Enhanced error handling to distinguish internal port conflicts from external ones, with more descriptive messages.
117
+ - Adjusted ACME challenge route addition to merge with existing port bindings when port is already in use.
118
+ - Refactored updateRoutes to release orphaned ports and bind only new required ports, minimizing rebinding operations.
119
+ - Improved certificate-manager logic to provide clearer error notifications when ACME port conflicts occur.
120
+
121
+ ## 2025-05-19 - 19.3.12 - fix(tests)
122
+ Update test mocks to include provisionAllCertificates methods in certificate manager stubs and related objects.
123
+
124
+ - Added async provisionAllCertificates functions to several test mocks (e.g. in test.port80-management.node.ts, test.route-callback-simple.ts, test.route-update-callback.node.ts, and test.simple-acme-mock.ts) to simulate ACME certificate provisioning.
125
+ - Enhanced logging and port-add history debugging for ACME challenge port addition.
126
+
127
+ ## 2025-05-19 - 19.3.11 - fix(logger)
128
+ Replace raw console logging calls with structured logger usage across certificate management, connection handling, and route processing for improved observability.
129
+
130
+ - Replaced console.log, console.warn, and console.error in SmartCertManager with logger.log for more consistent logging.
131
+ - Updated ConnectionManager and RouteConnectionHandler to log detailed connection events using a structured logger.
132
+ - Enhanced logging statements with contextual metadata such as connection IDs, remote IPs, target information, and component identifiers.
133
+ - Standardized log output across proxy modules to aid in debugging and monitoring.
134
+
135
+ ## 2025-05-19 - 19.3.10 - fix(certificate-manager, smart-proxy)
136
+ Fix race condition in ACME certificate provisioning and refactor certificate manager initialization to defer provisioning until after port listeners are active
137
+
138
+ - Removed superfluous provisionCertificatesAfterPortsReady method
139
+ - Made provisionAllCertificates public so that SmartProxy.start() calls it after ports are listening
140
+ - Updated SmartProxy.start() to wait for port setup (via PortManager) before triggering certificate provisioning
141
+ - Improved ACME HTTP-01 challenge timing so that port 80 (or configured ACME port) is guaranteed to be ready
142
+ - Updated documentation (changelog and Acme timing docs) and tests to reflect the change
143
+
144
+ ## 2025-05-19 - 19.3.10 - refactor(certificate-manager, smart-proxy)
145
+ Simplify certificate provisioning code by removing unnecessary wrapper method
146
+
147
+ - Removed superfluous SmartCertManager.provisionCertificatesAfterPortsReady() method
148
+ - Made SmartCertManager.provisionAllCertificates() public instead
149
+ - Updated SmartProxy.start() to call provisionAllCertificates() directly
150
+ - Updated documentation and tests to reflect the change
151
+ - No functional changes, just code simplification
152
+
153
+ ## 2025-05-19 - 19.3.9 - fix(certificate-manager, smart-proxy)
154
+ Fix ACME certificate provisioning timing to ensure ports are listening first
155
+
156
+ - Fixed race condition where certificate provisioning would start before ports were listening
157
+ - Modified SmartCertManager.initialize() to defer certificate provisioning
158
+ - Added SmartCertManager.provisionCertificatesAfterPortsReady() for delayed provisioning
159
+ - Updated SmartProxy.start() to call certificate provisioning after ports are ready
@@ -14,6 +14,5 @@ export * from './proxies/smart-proxy/utils/index.js';
14
14
  export { SniHandler } from './tls/sni/sni-handler.js';
15
15
  export * from './core/models/common-types.js';
16
16
  export type { IAcmeOptions } from './proxies/smart-proxy/models/interfaces.js';
17
- export * as forwarding from './forwarding/index.js';
18
17
  export * as tls from './tls/index.js';
19
18
  export * as routing from './routing/index.js';
package/dist_ts/index.js CHANGED
@@ -18,8 +18,7 @@ export { SniHandler } from './tls/sni/sni-handler.js';
18
18
  // Core types and utilities
19
19
  export * from './core/models/common-types.js';
20
20
  // Modular exports for new architecture
21
- export * as forwarding from './forwarding/index.js';
22
21
  // Certificate module has been removed - use SmartCertManager instead
23
22
  export * as tls from './tls/index.js';
24
23
  export * as routing from './routing/index.js';
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILHlCQUF5QjtBQUN6QixjQUFjLG1DQUFtQyxDQUFDO0FBRWxELDRCQUE0QjtBQUM1QixPQUFPLEVBQUUsU0FBUyxFQUFFLGtCQUFrQixFQUFFLGNBQWMsRUFBRSxjQUFjLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoSSxPQUFPLEVBQUUsa0JBQWtCLElBQUkscUJBQXFCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5Rix5RUFBeUU7QUFDekUsT0FBTyxFQUFFLFVBQVUsRUFBRSxpQkFBaUIsRUFBRSxlQUFlLEVBQUUsY0FBYyxFQUFFLFVBQVUsRUFBRSxlQUFlLEVBQUUsc0JBQXNCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN2TCxPQUFPLEVBQUUsa0JBQWtCLElBQUksWUFBWSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFJckYsY0FBYyxzQ0FBc0MsQ0FBQztBQUVyRCxrRUFBa0U7QUFDbEUsb0NBQW9DO0FBQ3BDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUN0RCxrRUFBa0U7QUFDbEUscUVBQXFFO0FBRXJFLDJCQUEyQjtBQUMzQixjQUFjLCtCQUErQixDQUFDO0FBSzlDLHVDQUF1QztBQUN2QyxPQUFPLEtBQUssVUFBVSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELHFFQUFxRTtBQUNyRSxPQUFPLEtBQUssR0FBRyxNQUFNLGdCQUFnQixDQUFDO0FBQ3RDLE9BQU8sS0FBSyxPQUFPLE1BQU0sb0JBQW9CLENBQUMifQ==
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILHlCQUF5QjtBQUN6QixjQUFjLG1DQUFtQyxDQUFDO0FBRWxELDRCQUE0QjtBQUM1QixPQUFPLEVBQUUsU0FBUyxFQUFFLGtCQUFrQixFQUFFLGNBQWMsRUFBRSxjQUFjLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoSSxPQUFPLEVBQUUsa0JBQWtCLElBQUkscUJBQXFCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5Rix5RUFBeUU7QUFDekUsT0FBTyxFQUFFLFVBQVUsRUFBRSxpQkFBaUIsRUFBRSxlQUFlLEVBQUUsY0FBYyxFQUFFLFVBQVUsRUFBRSxlQUFlLEVBQUUsc0JBQXNCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN2TCxPQUFPLEVBQUUsa0JBQWtCLElBQUksWUFBWSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFJckYsY0FBYyxzQ0FBc0MsQ0FBQztBQUVyRCxrRUFBa0U7QUFDbEUsb0NBQW9DO0FBQ3BDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUN0RCxrRUFBa0U7QUFDbEUscUVBQXFFO0FBRXJFLDJCQUEyQjtBQUMzQixjQUFjLCtCQUErQixDQUFDO0FBSzlDLHVDQUF1QztBQUN2QyxxRUFBcUU7QUFDckUsT0FBTyxLQUFLLEdBQUcsTUFBTSxnQkFBZ0IsQ0FBQztBQUN0QyxPQUFPLEtBQUssT0FBTyxNQUFNLG9CQUFvQixDQUFDIn0=
@@ -1,3 +1,3 @@
1
1
  import * as plugins from '../../../plugins.js';
2
2
  // Configuration moved to models/interfaces.ts as ISmartProxyOptions
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUtdHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9wcm94aWVzL3NtYXJ0LXByb3h5L21vZGVscy9yb3V0ZS10eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHFCQUFxQixDQUFDO0FBd1cvQyxvRUFBb0UifQ==
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUtdHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9wcm94aWVzL3NtYXJ0LXByb3h5L21vZGVscy9yb3V0ZS10eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHFCQUFxQixDQUFDO0FBdVcvQyxvRUFBb0UifQ==
@@ -7,5 +7,4 @@
7
7
  export * from './route-helpers.js';
8
8
  export * from './route-validators.js';
9
9
  export * from './route-utils.js';
10
- import { createWebSocketRoute as createWebSocketPatternRoute, createLoadBalancerRoute as createLoadBalancerPatternRoute, createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth } from './route-patterns.js';
11
- export { createWebSocketPatternRoute, createLoadBalancerPatternRoute, createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth };
10
+ export { createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth } from './route-helpers.js';
@@ -10,8 +10,7 @@ export * from './route-helpers.js';
10
10
  export * from './route-validators.js';
11
11
  // Export route utilities for route operations
12
12
  export * from './route-utils.js';
13
- // Export route patterns with renamed exports to avoid conflicts
14
- import { createWebSocketRoute as createWebSocketPatternRoute, createLoadBalancerRoute as createLoadBalancerPatternRoute, createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth } from './route-patterns.js';
15
- export { createWebSocketPatternRoute, createLoadBalancerPatternRoute, createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth };
13
+ // Export additional functions from route-helpers that weren't already exported
14
+ export { createApiGatewayRoute, addRateLimiting, addBasicAuth, addJwtAuth } from './route-helpers.js';
16
15
  // Migration utilities have been removed as they are no longer needed
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9wcm94aWVzL3NtYXJ0LXByb3h5L3V0aWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7OztHQUtHO0FBRUgseURBQXlEO0FBQ3pELGNBQWMsb0JBQW9CLENBQUM7QUFFbkMsOERBQThEO0FBQzlELGNBQWMsdUJBQXVCLENBQUM7QUFFdEMsOENBQThDO0FBQzlDLGNBQWMsa0JBQWtCLENBQUM7QUFFakMsZ0VBQWdFO0FBQ2hFLE9BQU8sRUFDTCxvQkFBb0IsSUFBSSwyQkFBMkIsRUFDbkQsdUJBQXVCLElBQUksOEJBQThCLEVBQ3pELHFCQUFxQixFQUNyQixlQUFlLEVBQ2YsWUFBWSxFQUNaLFVBQVUsRUFDWCxNQUFNLHFCQUFxQixDQUFDO0FBRTdCLE9BQU8sRUFDTCwyQkFBMkIsRUFDM0IsOEJBQThCLEVBQzlCLHFCQUFxQixFQUNyQixlQUFlLEVBQ2YsWUFBWSxFQUNaLFVBQVUsRUFDWCxDQUFDO0FBRUYscUVBQXFFIn0=
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9wcm94aWVzL3NtYXJ0LXByb3h5L3V0aWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7OztHQUtHO0FBRUgseURBQXlEO0FBQ3pELGNBQWMsb0JBQW9CLENBQUM7QUFFbkMsOERBQThEO0FBQzlELGNBQWMsdUJBQXVCLENBQUM7QUFFdEMsOENBQThDO0FBQzlDLGNBQWMsa0JBQWtCLENBQUM7QUFFakMsK0VBQStFO0FBQy9FLE9BQU8sRUFDTCxxQkFBcUIsRUFDckIsZUFBZSxFQUNmLFlBQVksRUFDWixVQUFVLEVBQ1gsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QixxRUFBcUUifQ==
@@ -94,12 +94,37 @@ export declare function createCompleteHttpsServer(domains: string | string[], ta
94
94
  /**
95
95
  * Create a load balancer route (round-robin between multiple backend hosts)
96
96
  * @param domains Domain(s) to match
97
- * @param hosts Array of backend hosts to load balance between
98
- * @param port Backend port
99
- * @param options Additional route options
97
+ * @param backendsOrHosts Array of backend servers OR array of host strings (legacy)
98
+ * @param portOrOptions Port number (legacy) OR options object
99
+ * @param options Additional route options (legacy)
100
100
  * @returns Route configuration object
101
101
  */
102
- export declare function createLoadBalancerRoute(domains: string | string[], hosts: string[], port: number, options?: {
102
+ export declare function createLoadBalancerRoute(domains: string | string[], backendsOrHosts: Array<{
103
+ host: string;
104
+ port: number;
105
+ }> | string[], portOrOptions?: number | {
106
+ tls?: {
107
+ mode: 'passthrough' | 'terminate' | 'terminate-and-reencrypt';
108
+ certificate?: 'auto' | {
109
+ key: string;
110
+ cert: string;
111
+ };
112
+ };
113
+ useTls?: boolean;
114
+ certificate?: 'auto' | {
115
+ key: string;
116
+ cert: string;
117
+ };
118
+ algorithm?: 'round-robin' | 'least-connections' | 'ip-hash';
119
+ healthCheck?: {
120
+ path: string;
121
+ interval: number;
122
+ timeout: number;
123
+ unhealthyThreshold: number;
124
+ healthyThreshold: number;
125
+ };
126
+ [key: string]: any;
127
+ }, options?: {
103
128
  tls?: {
104
129
  mode: 'passthrough' | 'terminate' | 'terminate-and-reencrypt';
105
130
  certificate?: 'auto' | {
@@ -135,14 +160,30 @@ export declare function createApiRoute(domains: string | string[], apiPath: stri
135
160
  /**
136
161
  * Create a WebSocket route configuration
137
162
  * @param domains Domain(s) to match
138
- * @param wsPath WebSocket path (e.g., "/ws")
139
- * @param target Target WebSocket server host and port
140
- * @param options Additional route options
163
+ * @param targetOrPath Target server OR WebSocket path (legacy)
164
+ * @param targetOrOptions Target server (legacy) OR options
165
+ * @param options Additional route options (legacy)
141
166
  * @returns Route configuration object
142
167
  */
143
- export declare function createWebSocketRoute(domains: string | string[], wsPath: string, target: {
168
+ export declare function createWebSocketRoute(domains: string | string[], targetOrPath: {
144
169
  host: string | string[];
145
170
  port: number;
171
+ } | string, targetOrOptions?: {
172
+ host: string | string[];
173
+ port: number;
174
+ } | {
175
+ useTls?: boolean;
176
+ certificate?: 'auto' | {
177
+ key: string;
178
+ cert: string;
179
+ };
180
+ path?: string;
181
+ httpPort?: number | number[];
182
+ httpsPort?: number | number[];
183
+ pingInterval?: number;
184
+ pingTimeout?: number;
185
+ name?: string;
186
+ [key: string]: any;
146
187
  }, options?: {
147
188
  useTls?: boolean;
148
189
  certificate?: 'auto' | {
@@ -356,3 +397,64 @@ export declare const SocketHandlers: {
356
397
  end: () => void;
357
398
  }) => void) => (socket: plugins.net.Socket, context: IRouteContext) => void;
358
399
  };
400
+ /**
401
+ * Create an API Gateway route pattern
402
+ * @param domains Domain(s) to match
403
+ * @param apiBasePath Base path for API endpoints (e.g., '/api')
404
+ * @param target Target host and port
405
+ * @param options Additional route options
406
+ * @returns API route configuration
407
+ */
408
+ export declare function createApiGatewayRoute(domains: string | string[], apiBasePath: string, target: {
409
+ host: string | string[];
410
+ port: number;
411
+ }, options?: {
412
+ useTls?: boolean;
413
+ certificate?: 'auto' | {
414
+ key: string;
415
+ cert: string;
416
+ };
417
+ addCorsHeaders?: boolean;
418
+ [key: string]: any;
419
+ }): IRouteConfig;
420
+ /**
421
+ * Create a rate limiting route pattern
422
+ * @param baseRoute Base route to add rate limiting to
423
+ * @param rateLimit Rate limiting configuration
424
+ * @returns Route with rate limiting
425
+ */
426
+ export declare function addRateLimiting(baseRoute: IRouteConfig, rateLimit: {
427
+ maxRequests: number;
428
+ window: number;
429
+ keyBy?: 'ip' | 'path' | 'header';
430
+ headerName?: string;
431
+ errorMessage?: string;
432
+ }): IRouteConfig;
433
+ /**
434
+ * Create a basic authentication route pattern
435
+ * @param baseRoute Base route to add authentication to
436
+ * @param auth Authentication configuration
437
+ * @returns Route with basic authentication
438
+ */
439
+ export declare function addBasicAuth(baseRoute: IRouteConfig, auth: {
440
+ users: Array<{
441
+ username: string;
442
+ password: string;
443
+ }>;
444
+ realm?: string;
445
+ excludePaths?: string[];
446
+ }): IRouteConfig;
447
+ /**
448
+ * Create a JWT authentication route pattern
449
+ * @param baseRoute Base route to add JWT authentication to
450
+ * @param jwt JWT authentication configuration
451
+ * @returns Route with JWT authentication
452
+ */
453
+ export declare function addJwtAuth(baseRoute: IRouteConfig, jwt: {
454
+ secret: string;
455
+ algorithm?: string;
456
+ issuer?: string;
457
+ audience?: string;
458
+ expiresIn?: number;
459
+ excludePaths?: string[];
460
+ }): IRouteConfig;