@push.rocks/smartproxy 21.1.6 → 22.4.2

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.
Files changed (103) hide show
  1. package/changelog.md +89 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/core/utils/shared-security-manager.d.ts +17 -0
  4. package/dist_ts/core/utils/shared-security-manager.js +66 -1
  5. package/dist_ts/proxies/http-proxy/default-certificates.d.ts +54 -0
  6. package/dist_ts/proxies/http-proxy/default-certificates.js +127 -0
  7. package/dist_ts/proxies/http-proxy/http-proxy.d.ts +1 -1
  8. package/dist_ts/proxies/http-proxy/http-proxy.js +9 -14
  9. package/dist_ts/proxies/http-proxy/index.d.ts +5 -1
  10. package/dist_ts/proxies/http-proxy/index.js +6 -2
  11. package/dist_ts/proxies/http-proxy/security-manager.d.ts +4 -12
  12. package/dist_ts/proxies/http-proxy/security-manager.js +66 -99
  13. package/dist_ts/proxies/nftables-proxy/index.d.ts +1 -0
  14. package/dist_ts/proxies/nftables-proxy/index.js +2 -1
  15. package/dist_ts/proxies/nftables-proxy/nftables-proxy.d.ts +4 -26
  16. package/dist_ts/proxies/nftables-proxy/nftables-proxy.js +84 -236
  17. package/dist_ts/proxies/nftables-proxy/utils/index.d.ts +9 -0
  18. package/dist_ts/proxies/nftables-proxy/utils/index.js +12 -0
  19. package/dist_ts/proxies/nftables-proxy/utils/nft-command-executor.d.ts +66 -0
  20. package/dist_ts/proxies/nftables-proxy/utils/nft-command-executor.js +131 -0
  21. package/dist_ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.d.ts +39 -0
  22. package/dist_ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.js +112 -0
  23. package/dist_ts/proxies/nftables-proxy/utils/nft-rule-validator.d.ts +59 -0
  24. package/dist_ts/proxies/nftables-proxy/utils/nft-rule-validator.js +130 -0
  25. package/dist_ts/proxies/smart-proxy/certificate-manager.js +4 -3
  26. package/dist_ts/proxies/smart-proxy/connection-manager.d.ts +13 -2
  27. package/dist_ts/proxies/smart-proxy/connection-manager.js +16 -6
  28. package/dist_ts/proxies/smart-proxy/http-proxy-bridge.js +35 -10
  29. package/dist_ts/proxies/smart-proxy/models/interfaces.d.ts +0 -1
  30. package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +17 -0
  31. package/dist_ts/proxies/smart-proxy/route-connection-handler.js +72 -9
  32. package/dist_ts/proxies/smart-proxy/security-manager.d.ts +14 -12
  33. package/dist_ts/proxies/smart-proxy/security-manager.js +80 -74
  34. package/dist_ts/proxies/smart-proxy/smart-proxy.js +1 -2
  35. package/dist_ts/proxies/smart-proxy/tls-manager.d.ts +2 -9
  36. package/dist_ts/proxies/smart-proxy/tls-manager.js +3 -26
  37. package/dist_ts/proxies/smart-proxy/utils/index.d.ts +1 -1
  38. package/dist_ts/proxies/smart-proxy/utils/index.js +3 -4
  39. package/dist_ts/proxies/smart-proxy/utils/route-helpers/api-helpers.d.ts +49 -0
  40. package/dist_ts/proxies/smart-proxy/utils/route-helpers/api-helpers.js +108 -0
  41. package/dist_ts/proxies/smart-proxy/utils/route-helpers/dynamic-helpers.d.ts +57 -0
  42. package/dist_ts/proxies/smart-proxy/utils/route-helpers/dynamic-helpers.js +89 -0
  43. package/dist_ts/proxies/smart-proxy/utils/route-helpers/http-helpers.d.ts +17 -0
  44. package/dist_ts/proxies/smart-proxy/utils/route-helpers/http-helpers.js +32 -0
  45. package/dist_ts/proxies/smart-proxy/utils/route-helpers/https-helpers.d.ts +68 -0
  46. package/dist_ts/proxies/smart-proxy/utils/route-helpers/https-helpers.js +117 -0
  47. package/dist_ts/proxies/smart-proxy/utils/route-helpers/index.d.ts +17 -0
  48. package/dist_ts/proxies/smart-proxy/utils/route-helpers/index.js +27 -0
  49. package/dist_ts/proxies/smart-proxy/utils/route-helpers/load-balancer-helpers.d.ts +63 -0
  50. package/dist_ts/proxies/smart-proxy/utils/route-helpers/load-balancer-helpers.js +105 -0
  51. package/dist_ts/proxies/smart-proxy/utils/route-helpers/nftables-helpers.d.ts +83 -0
  52. package/dist_ts/proxies/smart-proxy/utils/route-helpers/nftables-helpers.js +126 -0
  53. package/dist_ts/proxies/smart-proxy/utils/route-helpers/security-helpers.d.ts +47 -0
  54. package/dist_ts/proxies/smart-proxy/utils/route-helpers/security-helpers.js +66 -0
  55. package/dist_ts/proxies/smart-proxy/utils/route-helpers/socket-handlers.d.ts +70 -0
  56. package/dist_ts/proxies/smart-proxy/utils/route-helpers/socket-handlers.js +287 -0
  57. package/dist_ts/proxies/smart-proxy/utils/route-helpers/websocket-helpers.d.ts +46 -0
  58. package/dist_ts/proxies/smart-proxy/utils/route-helpers/websocket-helpers.js +67 -0
  59. package/dist_ts/proxies/smart-proxy/utils/route-helpers.d.ts +4 -457
  60. package/dist_ts/proxies/smart-proxy/utils/route-helpers.js +6 -950
  61. package/dist_ts/proxies/smart-proxy/utils/route-utils.js +2 -2
  62. package/dist_ts/proxies/smart-proxy/utils/route-validator.d.ts +67 -1
  63. package/dist_ts/proxies/smart-proxy/utils/route-validator.js +266 -6
  64. package/npmextra.json +12 -6
  65. package/package.json +34 -24
  66. package/readme.hints.md +184 -1
  67. package/readme.md +235 -172
  68. package/ts/00_commitinfo_data.ts +1 -1
  69. package/ts/core/utils/shared-security-manager.ts +98 -13
  70. package/ts/proxies/http-proxy/default-certificates.ts +150 -0
  71. package/ts/proxies/http-proxy/http-proxy.ts +9 -15
  72. package/ts/proxies/http-proxy/index.ts +6 -1
  73. package/ts/proxies/http-proxy/security-manager.ts +141 -161
  74. package/ts/proxies/nftables-proxy/index.ts +1 -0
  75. package/ts/proxies/nftables-proxy/nftables-proxy.ts +116 -290
  76. package/ts/proxies/nftables-proxy/utils/index.ts +38 -0
  77. package/ts/proxies/nftables-proxy/utils/nft-command-executor.ts +162 -0
  78. package/ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.ts +125 -0
  79. package/ts/proxies/nftables-proxy/utils/nft-rule-validator.ts +156 -0
  80. package/ts/proxies/smart-proxy/certificate-manager.ts +3 -2
  81. package/ts/proxies/smart-proxy/connection-manager.ts +21 -8
  82. package/ts/proxies/smart-proxy/http-proxy-bridge.ts +39 -13
  83. package/ts/proxies/smart-proxy/models/interfaces.ts +0 -1
  84. package/ts/proxies/smart-proxy/route-connection-handler.ts +88 -16
  85. package/ts/proxies/smart-proxy/security-manager.ts +98 -86
  86. package/ts/proxies/smart-proxy/smart-proxy.ts +0 -2
  87. package/ts/proxies/smart-proxy/tls-manager.ts +1 -37
  88. package/ts/proxies/smart-proxy/utils/index.ts +3 -5
  89. package/ts/proxies/smart-proxy/utils/route-helpers/api-helpers.ts +144 -0
  90. package/ts/proxies/smart-proxy/utils/route-helpers/dynamic-helpers.ts +124 -0
  91. package/ts/proxies/smart-proxy/utils/route-helpers/http-helpers.ts +40 -0
  92. package/ts/proxies/smart-proxy/utils/route-helpers/https-helpers.ts +163 -0
  93. package/ts/proxies/smart-proxy/utils/route-helpers/index.ts +62 -0
  94. package/ts/proxies/smart-proxy/utils/route-helpers/load-balancer-helpers.ts +154 -0
  95. package/ts/proxies/smart-proxy/utils/route-helpers/nftables-helpers.ts +202 -0
  96. package/ts/proxies/smart-proxy/utils/route-helpers/security-helpers.ts +96 -0
  97. package/ts/proxies/smart-proxy/utils/route-helpers/socket-handlers.ts +337 -0
  98. package/ts/proxies/smart-proxy/utils/route-helpers/websocket-helpers.ts +98 -0
  99. package/ts/proxies/smart-proxy/utils/route-helpers.ts +5 -1302
  100. package/ts/proxies/smart-proxy/utils/route-utils.ts +1 -1
  101. package/ts/proxies/smart-proxy/utils/route-validator.ts +289 -7
  102. package/ts/proxies/http-proxy/certificate-manager.ts +0 -244
  103. package/ts/proxies/smart-proxy/utils/route-validators.ts +0 -283
@@ -1,462 +1,9 @@
1
1
  /**
2
2
  * Route Helper Functions
3
3
  *
4
- * This file provides utility functions for creating route configurations for common scenarios.
5
- * These functions aim to simplify the creation of route configurations for typical use cases.
4
+ * This file re-exports all route helper functions for backwards compatibility.
5
+ * The actual implementations have been split into focused modules in the route-helpers/ directory.
6
6
  *
7
- * This module includes helper functions for creating:
8
- * - HTTP routes (createHttpRoute)
9
- * - HTTPS routes with TLS termination (createHttpsTerminateRoute)
10
- * - HTTP to HTTPS redirects (createHttpToHttpsRedirect)
11
- * - HTTPS passthrough routes (createHttpsPassthroughRoute)
12
- * - Complete HTTPS servers with redirects (createCompleteHttpsServer)
13
- * - Load balancer routes (createLoadBalancerRoute)
14
- * - API routes (createApiRoute)
15
- * - WebSocket routes (createWebSocketRoute)
16
- * - Port mapping routes (createPortMappingRoute, createOffsetPortMappingRoute)
17
- * - Dynamic routing (createDynamicRoute, createSmartLoadBalancer)
18
- * - NFTables routes (createNfTablesRoute, createNfTablesTerminateRoute)
7
+ * @see ./route-helpers/index.ts for the modular exports
19
8
  */
20
- import * as plugins from '../../../plugins.js';
21
- import type { IRouteConfig, TPortRange, IRouteContext } from '../models/route-types.js';
22
- /**
23
- * Create an HTTP-only route configuration
24
- * @param domains Domain(s) to match
25
- * @param target Target host and port
26
- * @param options Additional route options
27
- * @returns Route configuration object
28
- */
29
- export declare function createHttpRoute(domains: string | string[], target: {
30
- host: string | string[];
31
- port: number;
32
- }, options?: Partial<IRouteConfig>): IRouteConfig;
33
- /**
34
- * Create an HTTPS route with TLS termination (including HTTP redirect to HTTPS)
35
- * @param domains Domain(s) to match
36
- * @param target Target host and port
37
- * @param options Additional route options
38
- * @returns Route configuration object
39
- */
40
- export declare function createHttpsTerminateRoute(domains: string | string[], target: {
41
- host: string | string[];
42
- port: number;
43
- }, options?: {
44
- certificate?: 'auto' | {
45
- key: string;
46
- cert: string;
47
- };
48
- httpPort?: number | number[];
49
- httpsPort?: number | number[];
50
- reencrypt?: boolean;
51
- name?: string;
52
- [key: string]: any;
53
- }): IRouteConfig;
54
- /**
55
- * Create an HTTP to HTTPS redirect route
56
- * @param domains Domain(s) to match
57
- * @param httpsPort HTTPS port to redirect to (default: 443)
58
- * @param options Additional route options
59
- * @returns Route configuration object
60
- */
61
- export declare function createHttpToHttpsRedirect(domains: string | string[], httpsPort?: number, options?: Partial<IRouteConfig>): IRouteConfig;
62
- /**
63
- * Create an HTTPS passthrough route (SNI-based forwarding without TLS termination)
64
- * @param domains Domain(s) to match
65
- * @param target Target host and port
66
- * @param options Additional route options
67
- * @returns Route configuration object
68
- */
69
- export declare function createHttpsPassthroughRoute(domains: string | string[], target: {
70
- host: string | string[];
71
- port: number;
72
- }, options?: Partial<IRouteConfig>): IRouteConfig;
73
- /**
74
- * Create a complete HTTPS server with HTTP to HTTPS redirects
75
- * @param domains Domain(s) to match
76
- * @param target Target host and port
77
- * @param options Additional configuration options
78
- * @returns Array of two route configurations (HTTPS and HTTP redirect)
79
- */
80
- export declare function createCompleteHttpsServer(domains: string | string[], target: {
81
- host: string | string[];
82
- port: number;
83
- }, options?: {
84
- certificate?: 'auto' | {
85
- key: string;
86
- cert: string;
87
- };
88
- httpPort?: number | number[];
89
- httpsPort?: number | number[];
90
- reencrypt?: boolean;
91
- name?: string;
92
- [key: string]: any;
93
- }): IRouteConfig[];
94
- /**
95
- * Create a load balancer route (round-robin between multiple backend hosts)
96
- * @param domains Domain(s) to match
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
- * @returns Route configuration object
101
- */
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?: {
128
- tls?: {
129
- mode: 'passthrough' | 'terminate' | 'terminate-and-reencrypt';
130
- certificate?: 'auto' | {
131
- key: string;
132
- cert: string;
133
- };
134
- };
135
- [key: string]: any;
136
- }): IRouteConfig;
137
- /**
138
- * Create an API route configuration
139
- * @param domains Domain(s) to match
140
- * @param apiPath API base path (e.g., "/api")
141
- * @param target Target host and port
142
- * @param options Additional route options
143
- * @returns Route configuration object
144
- */
145
- export declare function createApiRoute(domains: string | string[], apiPath: string, target: {
146
- host: string | string[];
147
- port: number;
148
- }, options?: {
149
- useTls?: boolean;
150
- certificate?: 'auto' | {
151
- key: string;
152
- cert: string;
153
- };
154
- addCorsHeaders?: boolean;
155
- httpPort?: number | number[];
156
- httpsPort?: number | number[];
157
- name?: string;
158
- [key: string]: any;
159
- }): IRouteConfig;
160
- /**
161
- * Create a WebSocket route configuration
162
- * @param domains Domain(s) to match
163
- * @param targetOrPath Target server OR WebSocket path (legacy)
164
- * @param targetOrOptions Target server (legacy) OR options
165
- * @param options Additional route options (legacy)
166
- * @returns Route configuration object
167
- */
168
- export declare function createWebSocketRoute(domains: string | string[], targetOrPath: {
169
- host: string | string[];
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;
187
- }, options?: {
188
- useTls?: boolean;
189
- certificate?: 'auto' | {
190
- key: string;
191
- cert: string;
192
- };
193
- httpPort?: number | number[];
194
- httpsPort?: number | number[];
195
- pingInterval?: number;
196
- pingTimeout?: number;
197
- name?: string;
198
- [key: string]: any;
199
- }): IRouteConfig;
200
- /**
201
- * Create a helper function that applies a port offset
202
- * @param offset The offset to apply to the matched port
203
- * @returns A function that adds the offset to the matched port
204
- */
205
- export declare function createPortOffset(offset: number): (context: IRouteContext) => number;
206
- /**
207
- * Create a port mapping route with context-based port function
208
- * @param options Port mapping route options
209
- * @returns Route configuration object
210
- */
211
- export declare function createPortMappingRoute(options: {
212
- sourcePortRange: TPortRange;
213
- targetHost: string | string[] | ((context: IRouteContext) => string | string[]);
214
- portMapper: (context: IRouteContext) => number;
215
- name?: string;
216
- domains?: string | string[];
217
- priority?: number;
218
- [key: string]: any;
219
- }): IRouteConfig;
220
- /**
221
- * Create a simple offset port mapping route
222
- * @param options Offset port mapping route options
223
- * @returns Route configuration object
224
- */
225
- export declare function createOffsetPortMappingRoute(options: {
226
- ports: TPortRange;
227
- targetHost: string | string[];
228
- offset: number;
229
- name?: string;
230
- domains?: string | string[];
231
- priority?: number;
232
- [key: string]: any;
233
- }): IRouteConfig;
234
- /**
235
- * Create a dynamic route with context-based host and port mapping
236
- * @param options Dynamic route options
237
- * @returns Route configuration object
238
- */
239
- export declare function createDynamicRoute(options: {
240
- ports: TPortRange;
241
- targetHost: (context: IRouteContext) => string | string[];
242
- portMapper: (context: IRouteContext) => number;
243
- name?: string;
244
- domains?: string | string[];
245
- path?: string;
246
- clientIp?: string[];
247
- priority?: number;
248
- [key: string]: any;
249
- }): IRouteConfig;
250
- /**
251
- * Create a smart load balancer with dynamic domain-based backend selection
252
- * @param options Smart load balancer options
253
- * @returns Route configuration object
254
- */
255
- export declare function createSmartLoadBalancer(options: {
256
- ports: TPortRange;
257
- domainTargets: Record<string, string | string[]>;
258
- portMapper: (context: IRouteContext) => number;
259
- name?: string;
260
- defaultTarget?: string | string[];
261
- priority?: number;
262
- [key: string]: any;
263
- }): IRouteConfig;
264
- /**
265
- * Create an NFTables-based route for high-performance packet forwarding
266
- * @param nameOrDomains Name or domain(s) to match
267
- * @param target Target host and port
268
- * @param options Additional route options
269
- * @returns Route configuration object
270
- */
271
- export declare function createNfTablesRoute(nameOrDomains: string | string[], target: {
272
- host: string;
273
- port: number | 'preserve';
274
- }, options?: {
275
- ports?: TPortRange;
276
- protocol?: 'tcp' | 'udp' | 'all';
277
- preserveSourceIP?: boolean;
278
- ipAllowList?: string[];
279
- ipBlockList?: string[];
280
- maxRate?: string;
281
- priority?: number;
282
- useTls?: boolean;
283
- tableName?: string;
284
- useIPSets?: boolean;
285
- useAdvancedNAT?: boolean;
286
- }): IRouteConfig;
287
- /**
288
- * Create an NFTables-based TLS termination route
289
- * @param nameOrDomains Name or domain(s) to match
290
- * @param target Target host and port
291
- * @param options Additional route options
292
- * @returns Route configuration object
293
- */
294
- export declare function createNfTablesTerminateRoute(nameOrDomains: string | string[], target: {
295
- host: string;
296
- port: number | 'preserve';
297
- }, options?: {
298
- ports?: TPortRange;
299
- protocol?: 'tcp' | 'udp' | 'all';
300
- preserveSourceIP?: boolean;
301
- ipAllowList?: string[];
302
- ipBlockList?: string[];
303
- maxRate?: string;
304
- priority?: number;
305
- tableName?: string;
306
- useIPSets?: boolean;
307
- useAdvancedNAT?: boolean;
308
- certificate?: 'auto' | {
309
- key: string;
310
- cert: string;
311
- };
312
- }): IRouteConfig;
313
- /**
314
- * Create a complete NFTables-based HTTPS setup with HTTP redirect
315
- * @param nameOrDomains Name or domain(s) to match
316
- * @param target Target host and port
317
- * @param options Additional route options
318
- * @returns Array of two route configurations (HTTPS and HTTP redirect)
319
- */
320
- export declare function createCompleteNfTablesHttpsServer(nameOrDomains: string | string[], target: {
321
- host: string;
322
- port: number | 'preserve';
323
- }, options?: {
324
- httpPort?: TPortRange;
325
- httpsPort?: TPortRange;
326
- protocol?: 'tcp' | 'udp' | 'all';
327
- preserveSourceIP?: boolean;
328
- ipAllowList?: string[];
329
- ipBlockList?: string[];
330
- maxRate?: string;
331
- priority?: number;
332
- tableName?: string;
333
- useIPSets?: boolean;
334
- useAdvancedNAT?: boolean;
335
- certificate?: 'auto' | {
336
- key: string;
337
- cert: string;
338
- };
339
- }): IRouteConfig[];
340
- /**
341
- * Create a socket handler route configuration
342
- * @param domains Domain(s) to match
343
- * @param ports Port(s) to listen on
344
- * @param handler Socket handler function
345
- * @param options Additional route options
346
- * @returns Route configuration object
347
- */
348
- export declare function createSocketHandlerRoute(domains: string | string[], ports: TPortRange, handler: (socket: plugins.net.Socket) => void | Promise<void>, options?: {
349
- name?: string;
350
- priority?: number;
351
- path?: string;
352
- }): IRouteConfig;
353
- /**
354
- * Pre-built socket handlers for common use cases
355
- */
356
- export declare const SocketHandlers: {
357
- /**
358
- * Simple echo server handler
359
- */
360
- echo: (socket: plugins.net.Socket, context: IRouteContext) => void;
361
- /**
362
- * TCP proxy handler
363
- */
364
- proxy: (targetHost: string, targetPort: number) => (socket: plugins.net.Socket, context: IRouteContext) => void;
365
- /**
366
- * Line-based protocol handler
367
- */
368
- lineProtocol: (handler: (line: string, socket: plugins.net.Socket) => void) => (socket: plugins.net.Socket, context: IRouteContext) => void;
369
- /**
370
- * Simple HTTP response handler (for testing)
371
- */
372
- httpResponse: (statusCode: number, body: string) => (socket: plugins.net.Socket, context: IRouteContext) => void;
373
- /**
374
- * Block connection immediately
375
- */
376
- block: (message?: string) => (socket: plugins.net.Socket, context: IRouteContext) => void;
377
- /**
378
- * HTTP block response
379
- */
380
- httpBlock: (statusCode?: number, message?: string) => (socket: plugins.net.Socket, context: IRouteContext) => void;
381
- /**
382
- * HTTP redirect handler
383
- * Now uses the centralized detection module for HTTP parsing
384
- */
385
- httpRedirect: (locationTemplate: string, statusCode?: number) => (socket: plugins.net.Socket, context: IRouteContext) => void;
386
- /**
387
- * HTTP server handler for ACME challenges and other HTTP needs
388
- * Now uses the centralized detection module for HTTP parsing
389
- */
390
- httpServer: (handler: (req: {
391
- method: string;
392
- url: string;
393
- headers: Record<string, string>;
394
- body?: string;
395
- }, res: {
396
- status: (code: number) => void;
397
- header: (name: string, value: string) => void;
398
- send: (data: string) => void;
399
- end: () => void;
400
- }) => void) => (socket: plugins.net.Socket, context: IRouteContext) => void;
401
- };
402
- /**
403
- * Create an API Gateway route pattern
404
- * @param domains Domain(s) to match
405
- * @param apiBasePath Base path for API endpoints (e.g., '/api')
406
- * @param target Target host and port
407
- * @param options Additional route options
408
- * @returns API route configuration
409
- */
410
- export declare function createApiGatewayRoute(domains: string | string[], apiBasePath: string, target: {
411
- host: string | string[];
412
- port: number;
413
- }, options?: {
414
- useTls?: boolean;
415
- certificate?: 'auto' | {
416
- key: string;
417
- cert: string;
418
- };
419
- addCorsHeaders?: boolean;
420
- [key: string]: any;
421
- }): IRouteConfig;
422
- /**
423
- * Create a rate limiting route pattern
424
- * @param baseRoute Base route to add rate limiting to
425
- * @param rateLimit Rate limiting configuration
426
- * @returns Route with rate limiting
427
- */
428
- export declare function addRateLimiting(baseRoute: IRouteConfig, rateLimit: {
429
- maxRequests: number;
430
- window: number;
431
- keyBy?: 'ip' | 'path' | 'header';
432
- headerName?: string;
433
- errorMessage?: string;
434
- }): IRouteConfig;
435
- /**
436
- * Create a basic authentication route pattern
437
- * @param baseRoute Base route to add authentication to
438
- * @param auth Authentication configuration
439
- * @returns Route with basic authentication
440
- */
441
- export declare function addBasicAuth(baseRoute: IRouteConfig, auth: {
442
- users: Array<{
443
- username: string;
444
- password: string;
445
- }>;
446
- realm?: string;
447
- excludePaths?: string[];
448
- }): IRouteConfig;
449
- /**
450
- * Create a JWT authentication route pattern
451
- * @param baseRoute Base route to add JWT authentication to
452
- * @param jwt JWT authentication configuration
453
- * @returns Route with JWT authentication
454
- */
455
- export declare function addJwtAuth(baseRoute: IRouteConfig, jwt: {
456
- secret: string;
457
- algorithm?: string;
458
- issuer?: string;
459
- audience?: string;
460
- expiresIn?: number;
461
- excludePaths?: string[];
462
- }): IRouteConfig;
9
+ export * from './route-helpers/index.js';