@push.rocks/smartproxy 15.0.2 → 16.0.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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/certificate/index.d.ts +10 -4
- package/dist_ts/certificate/index.js +5 -7
- package/dist_ts/certificate/models/certificate-types.d.ts +35 -15
- package/dist_ts/certificate/providers/cert-provisioner.d.ts +41 -15
- package/dist_ts/certificate/providers/cert-provisioner.js +201 -41
- package/dist_ts/forwarding/config/forwarding-types.d.ts +40 -76
- package/dist_ts/forwarding/config/forwarding-types.js +19 -18
- package/dist_ts/forwarding/config/index.d.ts +4 -2
- package/dist_ts/forwarding/config/index.js +5 -3
- package/dist_ts/forwarding/handlers/base-handler.js +3 -1
- package/dist_ts/forwarding/index.d.ts +5 -6
- package/dist_ts/forwarding/index.js +3 -3
- package/dist_ts/http/models/http-types.js +1 -1
- package/dist_ts/http/port80/acme-interfaces.d.ts +30 -0
- package/dist_ts/http/port80/acme-interfaces.js +46 -1
- package/dist_ts/http/port80/port80-handler.d.ts +17 -2
- package/dist_ts/http/port80/port80-handler.js +49 -11
- package/dist_ts/proxies/smart-proxy/models/interfaces.d.ts +2 -61
- package/dist_ts/proxies/smart-proxy/models/interfaces.js +5 -4
- package/dist_ts/proxies/smart-proxy/models/route-types.d.ts +118 -4
- package/dist_ts/proxies/smart-proxy/network-proxy-bridge.d.ts +70 -4
- package/dist_ts/proxies/smart-proxy/network-proxy-bridge.js +193 -43
- package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +2 -5
- package/dist_ts/proxies/smart-proxy/route-connection-handler.js +25 -146
- package/dist_ts/proxies/smart-proxy/route-helpers/index.d.ts +7 -0
- package/dist_ts/proxies/smart-proxy/route-helpers/index.js +9 -0
- package/dist_ts/proxies/smart-proxy/route-helpers.d.ts +54 -1
- package/dist_ts/proxies/smart-proxy/route-helpers.js +102 -1
- package/dist_ts/proxies/smart-proxy/route-manager.d.ts +3 -9
- package/dist_ts/proxies/smart-proxy/route-manager.js +3 -115
- package/dist_ts/proxies/smart-proxy/smart-proxy.d.ts +72 -10
- package/dist_ts/proxies/smart-proxy/smart-proxy.js +135 -268
- package/dist_ts/proxies/smart-proxy/timeout-manager.js +3 -3
- package/dist_ts/proxies/smart-proxy/utils/index.d.ts +12 -0
- package/dist_ts/proxies/smart-proxy/utils/index.js +19 -0
- package/dist_ts/proxies/smart-proxy/utils/route-helpers.d.ts +174 -0
- package/dist_ts/proxies/smart-proxy/utils/route-helpers.js +332 -0
- package/dist_ts/proxies/smart-proxy/utils/route-migration-utils.d.ts +51 -0
- package/dist_ts/proxies/smart-proxy/utils/route-migration-utils.js +124 -0
- package/dist_ts/proxies/smart-proxy/utils/route-patterns.d.ts +131 -0
- package/dist_ts/proxies/smart-proxy/utils/route-patterns.js +217 -0
- package/dist_ts/proxies/smart-proxy/utils/route-utils.d.ts +79 -0
- package/dist_ts/proxies/smart-proxy/utils/route-utils.js +266 -0
- package/dist_ts/proxies/smart-proxy/utils/route-validators.d.ts +73 -0
- package/dist_ts/proxies/smart-proxy/utils/route-validators.js +242 -0
- package/package.json +1 -1
- package/readme.md +139 -111
- package/readme.plan.md +164 -312
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/certificate/index.ts +17 -9
- package/ts/certificate/models/certificate-types.ts +37 -16
- package/ts/certificate/providers/cert-provisioner.ts +247 -54
- package/ts/forwarding/config/forwarding-types.ts +79 -107
- package/ts/forwarding/config/index.ts +4 -2
- package/ts/forwarding/handlers/base-handler.ts +4 -2
- package/ts/forwarding/index.ts +3 -2
- package/ts/http/models/http-types.ts +0 -1
- package/ts/http/port80/acme-interfaces.ts +84 -0
- package/ts/http/port80/port80-handler.ts +61 -15
- package/ts/proxies/smart-proxy/models/interfaces.ts +7 -64
- package/ts/proxies/smart-proxy/models/route-types.ts +152 -22
- package/ts/proxies/smart-proxy/network-proxy-bridge.ts +226 -55
- package/ts/proxies/smart-proxy/route-connection-handler.ts +36 -205
- package/ts/proxies/smart-proxy/route-helpers/index.ts +9 -0
- package/ts/proxies/smart-proxy/route-helpers.ts +165 -11
- package/ts/proxies/smart-proxy/route-manager.ts +3 -130
- package/ts/proxies/smart-proxy/smart-proxy.ts +157 -329
- package/ts/proxies/smart-proxy/timeout-manager.ts +2 -2
- package/ts/proxies/smart-proxy/utils/index.ts +40 -0
- package/ts/proxies/smart-proxy/utils/route-helpers.ts +455 -0
- package/ts/proxies/smart-proxy/utils/route-migration-utils.ts +165 -0
- package/ts/proxies/smart-proxy/utils/route-patterns.ts +309 -0
- package/ts/proxies/smart-proxy/utils/route-utils.ts +330 -0
- package/ts/proxies/smart-proxy/utils/route-validators.ts +269 -0
- package/ts/forwarding/config/domain-config.ts +0 -28
- package/ts/forwarding/config/domain-manager.ts +0 -283
- package/ts/proxies/smart-proxy/connection-handler.ts +0 -1240
- package/ts/proxies/smart-proxy/port-range-manager.ts +0 -211
- /package/ts/proxies/smart-proxy/{domain-config-manager.ts → domain-config-manager.ts.bak} +0 -0
|
@@ -7,8 +7,7 @@ import type {
|
|
|
7
7
|
} from './models/route-types.js';
|
|
8
8
|
import type {
|
|
9
9
|
ISmartProxyOptions,
|
|
10
|
-
IRoutedSmartProxyOptions
|
|
11
|
-
IDomainConfig
|
|
10
|
+
IRoutedSmartProxyOptions
|
|
12
11
|
} from './models/interfaces.js';
|
|
13
12
|
import {
|
|
14
13
|
isRoutedOptions,
|
|
@@ -304,135 +303,9 @@ export class RouteManager extends plugins.EventEmitter {
|
|
|
304
303
|
}
|
|
305
304
|
|
|
306
305
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
306
|
+
* Domain-based configuration methods have been removed
|
|
307
|
+
* as part of the migration to pure route-based configuration
|
|
309
308
|
*/
|
|
310
|
-
public domainConfigToRoutes(domainConfig: IDomainConfig): IRouteConfig[] {
|
|
311
|
-
const routes: IRouteConfig[] = [];
|
|
312
|
-
const { domains, forwarding } = domainConfig;
|
|
313
|
-
|
|
314
|
-
// Determine the action based on forwarding type
|
|
315
|
-
let action: IRouteAction = {
|
|
316
|
-
type: 'forward',
|
|
317
|
-
target: {
|
|
318
|
-
host: forwarding.target.host,
|
|
319
|
-
port: forwarding.target.port
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
// Set TLS mode based on forwarding type
|
|
324
|
-
switch (forwarding.type) {
|
|
325
|
-
case 'http-only':
|
|
326
|
-
// No TLS settings needed
|
|
327
|
-
break;
|
|
328
|
-
case 'https-passthrough':
|
|
329
|
-
action.tls = { mode: 'passthrough' };
|
|
330
|
-
break;
|
|
331
|
-
case 'https-terminate-to-http':
|
|
332
|
-
action.tls = {
|
|
333
|
-
mode: 'terminate',
|
|
334
|
-
certificate: forwarding.https?.customCert ? {
|
|
335
|
-
key: forwarding.https.customCert.key,
|
|
336
|
-
cert: forwarding.https.customCert.cert
|
|
337
|
-
} : 'auto'
|
|
338
|
-
};
|
|
339
|
-
break;
|
|
340
|
-
case 'https-terminate-to-https':
|
|
341
|
-
action.tls = {
|
|
342
|
-
mode: 'terminate-and-reencrypt',
|
|
343
|
-
certificate: forwarding.https?.customCert ? {
|
|
344
|
-
key: forwarding.https.customCert.key,
|
|
345
|
-
cert: forwarding.https.customCert.cert
|
|
346
|
-
} : 'auto'
|
|
347
|
-
};
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Add security settings if present
|
|
352
|
-
if (forwarding.security) {
|
|
353
|
-
action.security = {
|
|
354
|
-
allowedIps: forwarding.security.allowedIps,
|
|
355
|
-
blockedIps: forwarding.security.blockedIps,
|
|
356
|
-
maxConnections: forwarding.security.maxConnections
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// Add advanced settings if present
|
|
361
|
-
if (forwarding.advanced) {
|
|
362
|
-
action.advanced = {
|
|
363
|
-
timeout: forwarding.advanced.timeout,
|
|
364
|
-
headers: forwarding.advanced.headers,
|
|
365
|
-
keepAlive: forwarding.advanced.keepAlive
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// Determine which port to use based on forwarding type
|
|
370
|
-
const defaultPort = forwarding.type.startsWith('https') ? 443 : 80;
|
|
371
|
-
|
|
372
|
-
// Add the main route
|
|
373
|
-
routes.push({
|
|
374
|
-
match: {
|
|
375
|
-
ports: defaultPort,
|
|
376
|
-
domains
|
|
377
|
-
},
|
|
378
|
-
action,
|
|
379
|
-
name: `Route for ${domains.join(', ')}`
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
// Add HTTP redirect if needed
|
|
383
|
-
if (forwarding.http?.redirectToHttps) {
|
|
384
|
-
routes.push({
|
|
385
|
-
match: {
|
|
386
|
-
ports: 80,
|
|
387
|
-
domains
|
|
388
|
-
},
|
|
389
|
-
action: {
|
|
390
|
-
type: 'redirect',
|
|
391
|
-
redirect: {
|
|
392
|
-
to: 'https://{domain}{path}',
|
|
393
|
-
status: 301
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
name: `HTTP Redirect for ${domains.join(', ')}`,
|
|
397
|
-
priority: 100 // Higher priority for redirects
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// Add port ranges if specified
|
|
402
|
-
if (forwarding.advanced?.portRanges) {
|
|
403
|
-
for (const range of forwarding.advanced.portRanges) {
|
|
404
|
-
routes.push({
|
|
405
|
-
match: {
|
|
406
|
-
ports: [{ from: range.from, to: range.to }],
|
|
407
|
-
domains
|
|
408
|
-
},
|
|
409
|
-
action,
|
|
410
|
-
name: `Port Range ${range.from}-${range.to} for ${domains.join(', ')}`
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return routes;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Update routes based on domain configs
|
|
420
|
-
* (For backward compatibility with code that still uses domainConfigs)
|
|
421
|
-
*/
|
|
422
|
-
public updateFromDomainConfigs(domainConfigs: IDomainConfig[]): void {
|
|
423
|
-
const routes: IRouteConfig[] = [];
|
|
424
|
-
|
|
425
|
-
// Convert each domain config to routes
|
|
426
|
-
for (const config of domainConfigs) {
|
|
427
|
-
routes.push(...this.domainConfigToRoutes(config));
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// Merge with existing routes that aren't derived from domain configs
|
|
431
|
-
const nonDomainRoutes = this.routes.filter(r =>
|
|
432
|
-
!r.name || !r.name.includes('for '));
|
|
433
|
-
|
|
434
|
-
this.updateRoutes([...nonDomainRoutes, ...routes]);
|
|
435
|
-
}
|
|
436
309
|
|
|
437
310
|
/**
|
|
438
311
|
* Validate the route configuration and return any warnings
|