Compare commits

...

14 Commits

Author SHA1 Message Date
1387928938 10.0.11
Some checks failed
Default (tags) / security (push) Successful in 34s
Default (tags) / test (push) Failing after 1m14s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-05 10:52:49 +00:00
19578b061e fix(dependencies): Bump @push.rocks/smartacme to ^7.2.5 and @tsclass/tsclass to ^9.2.0; update MemoryCertManager import to use plugins.smartacme.certmanagers.MemoryCertManager() 2025-05-05 10:52:48 +00:00
e8a539829a 10.0.10
Some checks failed
Default (tags) / security (push) Successful in 42s
Default (tags) / test (push) Failing after 1m15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-05 10:46:05 +00:00
a646f4ad28 fix(docs): Update README: rename certProviderFunction to certProvisionFunction in configuration options for consistency. 2025-05-05 10:46:05 +00:00
aa70dcc299 10.0.9
Some checks failed
Default (tags) / security (push) Successful in 25s
Default (tags) / test (push) Failing after 1m13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-05 10:30:08 +00:00
adb85d920f fix(documentation): Update documentation to use certProviderFunction instead of certProvider in SmartProxy settings. 2025-05-05 10:30:08 +00:00
2e4c6312cd 10.0.8
Some checks failed
Default (tags) / security (push) Successful in 32s
Default (tags) / test (push) Failing after 1m17s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-05 10:29:00 +00:00
9b773608c7 fix(smartproxy): rename certProvider to certProvisionFunction in certificate provisioning interfaces and SmartProxy 2025-05-05 10:29:00 +00:00
3502807023 10.0.7
Some checks failed
Default (tags) / security (push) Successful in 43s
Default (tags) / test (push) Failing after 1m26s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-04 13:49:22 +00:00
c6dff8b78d fix(core): refactor: Rename IPortProxySettings to ISmartProxyOptions in internal modules 2025-05-04 13:49:22 +00:00
12b18373db 10.0.6
Some checks failed
Default (tags) / security (push) Successful in 31s
Default (tags) / test (push) Failing after 1m15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-04 13:05:48 +00:00
30c25ec70c fix(smartproxy): No changes detected in project files. This commit updates commit info without modifying any functionality. 2025-05-04 13:05:48 +00:00
434834fc06 10.0.5
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 1m15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-05-04 13:04:35 +00:00
e7243243d0 fix(exports/types): Refactor exports and remove duplicate IReverseProxyConfig interface 2025-05-04 13:04:34 +00:00
20 changed files with 97 additions and 57 deletions

View File

@ -1,5 +1,47 @@
# Changelog # Changelog
## 2025-05-05 - 10.0.11 - fix(dependencies)
Bump @push.rocks/smartacme to ^7.2.5 and @tsclass/tsclass to ^9.2.0; update MemoryCertManager import to use plugins.smartacme.certmanagers.MemoryCertManager()
- Updated @push.rocks/smartacme from ^7.2.4 to ^7.2.5
- Updated @tsclass/tsclass from ^9.1.0 to ^9.2.0
- Refactored MemoryCertManager instantiation to use the new import path
## 2025-05-05 - 10.0.10 - fix(docs)
Update README: rename certProviderFunction to certProvisionFunction in configuration options for consistency.
- Replaced 'certProviderFunction' with 'certProvisionFunction' in the docs to reflect the updated API.
- Ensured all references in the readme are consistent with the new naming convention.
## 2025-05-05 - 10.0.9 - fix(documentation)
Update documentation to use 'certProviderFunction' instead of 'certProvider' in SmartProxy settings.
- Renamed 'certProvider' to 'certProviderFunction' in README examples and configuration options.
- Ensured consistency in the configuration section of the documentation.
## 2025-05-05 - 10.0.8 - fix(smartproxy)
rename certProvider to certProvisionFunction in certificate provisioning interfaces and SmartProxy
- In ts/smartproxy/classes.pp.interfaces.ts, renamed the optional property 'certProvider' to 'certProvisionFunction'.
- In ts/smartproxy/classes.smartproxy.ts, updated references from this.settings.certProvider to this.settings.certProvisionFunction.
## 2025-05-04 - 10.0.7 - fix(core)
refactor: Rename IPortProxySettings to ISmartProxyOptions in internal modules
- Replaced IPortProxySettings with ISmartProxyOptions in connection handler, connection manager, domain config manager, security manager, timeout manager, TLS manager, and network proxy bridge.
- Updated type imports and constructors accordingly while preserving backward compatibility via export alias.
## 2025-05-04 - 10.0.6 - fix(smartproxy)
No changes detected in project files. This commit updates commit info without modifying any functionality.
## 2025-05-04 - 10.0.5 - fix(exports/types)
Refactor exports and remove duplicate IReverseProxyConfig interface
- Removed redundant IReverseProxyConfig extension from ts/common/types.ts
- Updated ts/index.ts to export networkproxy via index.js instead of classes.np.networkproxy.js
- Simplified module exports to avoid duplicate interface definitions
## 2025-05-04 - 10.0.4 - fix(core) ## 2025-05-04 - 10.0.4 - fix(core)
Refactor module exports and update packageManager version in package.json Refactor module exports and update packageManager version in package.json

View File

@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartproxy", "name": "@push.rocks/smartproxy",
"version": "10.0.4", "version": "10.0.11",
"private": false, "private": false,
"description": "A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.", "description": "A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -24,14 +24,14 @@
}, },
"dependencies": { "dependencies": {
"@push.rocks/lik": "^6.2.2", "@push.rocks/lik": "^6.2.2",
"@push.rocks/smartacme": "^7.2.4", "@push.rocks/smartacme": "^7.2.5",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartnetwork": "^4.0.1", "@push.rocks/smartnetwork": "^4.0.1",
"@push.rocks/smartpromise": "^4.2.3", "@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^2.1.0", "@push.rocks/smartrequest": "^2.1.0",
"@push.rocks/smartstring": "^4.0.15", "@push.rocks/smartstring": "^4.0.15",
"@push.rocks/taskbuffer": "^3.1.7", "@push.rocks/taskbuffer": "^3.1.7",
"@tsclass/tsclass": "^9.1.0", "@tsclass/tsclass": "^9.2.0",
"@types/minimatch": "^5.1.2", "@types/minimatch": "^5.1.2",
"@types/ws": "^8.18.1", "@types/ws": "^8.18.1",
"minimatch": "^10.0.1", "minimatch": "^10.0.1",

32
pnpm-lock.yaml generated
View File

@ -12,8 +12,8 @@ importers:
specifier: ^6.2.2 specifier: ^6.2.2
version: 6.2.2 version: 6.2.2
'@push.rocks/smartacme': '@push.rocks/smartacme':
specifier: ^7.2.4 specifier: ^7.2.5
version: 7.2.4(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) version: 7.2.5(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)
'@push.rocks/smartdelay': '@push.rocks/smartdelay':
specifier: ^3.0.5 specifier: ^3.0.5
version: 3.0.5 version: 3.0.5
@ -33,8 +33,8 @@ importers:
specifier: ^3.1.7 specifier: ^3.1.7
version: 3.1.7 version: 3.1.7
'@tsclass/tsclass': '@tsclass/tsclass':
specifier: ^9.1.0 specifier: ^9.2.0
version: 9.1.0 version: 9.2.0
'@types/minimatch': '@types/minimatch':
specifier: ^5.1.2 specifier: ^5.1.2
version: 5.1.2 version: 5.1.2
@ -355,8 +355,8 @@ packages:
'@cloudflare/workers-types@4.20250303.0': '@cloudflare/workers-types@4.20250303.0':
resolution: {integrity: sha512-O7F7nRT4bbmwHf3gkRBLfJ7R6vHIJ/oZzWdby6obOiw2yavUfp/AIwS7aO2POu5Cv8+h3TXS3oHs3kKCZLraUA==} resolution: {integrity: sha512-O7F7nRT4bbmwHf3gkRBLfJ7R6vHIJ/oZzWdby6obOiw2yavUfp/AIwS7aO2POu5Cv8+h3TXS3oHs3kKCZLraUA==}
'@cloudflare/workers-types@4.20250504.0': '@cloudflare/workers-types@4.20250505.0':
resolution: {integrity: sha512-/70Kb5vrqj+O0krOuS8LVLiCeDuCGzQy4X+wGGs4/rHv0gZJulv7Uj5YlUjIaRemK/Dyrzlk7WNJwTy8yv0cIw==} resolution: {integrity: sha512-pLQ/UaCupEy3fTTfy7yCR7FuAbawvCohYAdadGHPUfzssksA9MhkqBLlzYWRwIoC34R8grVn4XOCknEg+NMr0Q==}
'@colors/colors@1.6.0': '@colors/colors@1.6.0':
resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==}
@ -872,8 +872,8 @@ packages:
'@push.rocks/qenv@6.1.0': '@push.rocks/qenv@6.1.0':
resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==} resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==}
'@push.rocks/smartacme@7.2.4': '@push.rocks/smartacme@7.2.5':
resolution: {integrity: sha512-0ciewRheDAwv0ER0ZyLQVLAn0ZoG1++ibSZ14HoXn8GOTOLyuRLWLNDQL2fI4LtLxeaNYmQUS+f7tt4KaZb/UA==} resolution: {integrity: sha512-Mn7qutAHd+mIbyq0Br/zyBBki7ATaZ/ofZQvnrR4xDvZiL8sBKeNx3iotb7jyHNYax5JUBh7slDKUxVjQBFC6Q==}
'@push.rocks/smartarchive@3.0.8': '@push.rocks/smartarchive@3.0.8':
resolution: {integrity: sha512-1jPmR0b7hXmjYQoRiTlRXrIbZcdcFmSdGOfznufjcDpGPe86Km0d8TBnzqghTx4dTihzKC67IxAaz/DM3lvxpA==} resolution: {integrity: sha512-1jPmR0b7hXmjYQoRiTlRXrIbZcdcFmSdGOfznufjcDpGPe86Km0d8TBnzqghTx4dTihzKC67IxAaz/DM3lvxpA==}
@ -1567,8 +1567,8 @@ packages:
'@tsclass/tsclass@8.2.1': '@tsclass/tsclass@8.2.1':
resolution: {integrity: sha512-bRDCfJTipsTcK6eEokWdsOR1mGCQFeM7zTg6PRHzbxTWQcWQD9AhEr2q3CrPcmAbvIS7fvkO6/pU/mPm1MZxhQ==} resolution: {integrity: sha512-bRDCfJTipsTcK6eEokWdsOR1mGCQFeM7zTg6PRHzbxTWQcWQD9AhEr2q3CrPcmAbvIS7fvkO6/pU/mPm1MZxhQ==}
'@tsclass/tsclass@9.1.0': '@tsclass/tsclass@9.2.0':
resolution: {integrity: sha512-PkG1bXK/bqVtxaRHje+iJHjtcdRHLHrNTOkzqh+jv2A7mgiyNo2YBJIl4eEJLkw1X3FwEFU4vCAtsegSmJgRug==} resolution: {integrity: sha512-A6ULEkQfYgOnCKQVQRt26O7PRzFo4PE2EoD25RAtnuFuVrNwGynYC20Vee2c8KAOyI7nQ/LaREki9KAX4AHOHQ==}
'@types/accepts@1.3.7': '@types/accepts@1.3.7':
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==} resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
@ -4760,7 +4760,7 @@ snapshots:
'@api.global/typedrequest': 3.1.10 '@api.global/typedrequest': 3.1.10
'@api.global/typedrequest-interfaces': 3.0.19 '@api.global/typedrequest-interfaces': 3.0.19
'@api.global/typedsocket': 3.0.1 '@api.global/typedsocket': 3.0.1
'@cloudflare/workers-types': 4.20250504.0 '@cloudflare/workers-types': 4.20250505.0
'@design.estate/dees-comms': 1.0.27 '@design.estate/dees-comms': 1.0.27
'@push.rocks/lik': 6.2.2 '@push.rocks/lik': 6.2.2
'@push.rocks/smartchok': 1.0.34 '@push.rocks/smartchok': 1.0.34
@ -4827,7 +4827,7 @@ snapshots:
'@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrequest': 2.1.0 '@push.rocks/smartrequest': 2.1.0
'@push.rocks/smartstring': 4.0.15 '@push.rocks/smartstring': 4.0.15
'@tsclass/tsclass': 9.1.0 '@tsclass/tsclass': 9.2.0
cloudflare: 4.2.0 cloudflare: 4.2.0
transitivePeerDependencies: transitivePeerDependencies:
- encoding - encoding
@ -5671,7 +5671,7 @@ snapshots:
'@cloudflare/workers-types@4.20250303.0': {} '@cloudflare/workers-types@4.20250303.0': {}
'@cloudflare/workers-types@4.20250504.0': {} '@cloudflare/workers-types@4.20250505.0': {}
'@colors/colors@1.6.0': {} '@colors/colors@1.6.0': {}
@ -6284,7 +6284,7 @@ snapshots:
'@push.rocks/smartlog': 3.0.7 '@push.rocks/smartlog': 3.0.7
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartacme@7.2.4(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)': '@push.rocks/smartacme@7.2.5(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)':
dependencies: dependencies:
'@api.global/typedserver': 3.0.74 '@api.global/typedserver': 3.0.74
'@apiclient.xyz/cloudflare': 6.4.1 '@apiclient.xyz/cloudflare': 6.4.1
@ -6298,7 +6298,7 @@ snapshots:
'@push.rocks/smartstring': 4.0.15 '@push.rocks/smartstring': 4.0.15
'@push.rocks/smarttime': 4.1.1 '@push.rocks/smarttime': 4.1.1
'@push.rocks/smartunique': 3.0.9 '@push.rocks/smartunique': 3.0.9
'@tsclass/tsclass': 9.1.0 '@tsclass/tsclass': 9.2.0
acme-client: 5.4.0 acme-client: 5.4.0
transitivePeerDependencies: transitivePeerDependencies:
- '@aws-sdk/credential-providers' - '@aws-sdk/credential-providers'
@ -7736,7 +7736,7 @@ snapshots:
dependencies: dependencies:
type-fest: 4.40.1 type-fest: 4.40.1
'@tsclass/tsclass@9.1.0': '@tsclass/tsclass@9.2.0':
dependencies: dependencies:
type-fest: 4.40.1 type-fest: 4.40.1

View File

@ -384,7 +384,7 @@ Listen for certificate events via EventEmitter:
- **SmartProxy**: - **SmartProxy**:
- `certificate` (domain, publicKey, privateKey, expiryDate, source, isRenewal) - `certificate` (domain, publicKey, privateKey, expiryDate, source, isRenewal)
Provide a `certProvider(domain)` in SmartProxy settings to supply static certs or return `'http01'`. Provide a `certProvisionFunction(domain)` in SmartProxy settings to supply static certs or return `'http01'`.
## Configuration Options ## Configuration Options
@ -429,7 +429,7 @@ Provide a `certProvider(domain)` in SmartProxy settings to supply static certs o
- `sniEnabled`, `defaultAllowedIPs`, `preserveSourceIP` (booleans) - `sniEnabled`, `defaultAllowedIPs`, `preserveSourceIP` (booleans)
- Timeouts: `initialDataTimeout`, `socketTimeout`, `inactivityTimeout`, etc. - Timeouts: `initialDataTimeout`, `socketTimeout`, `inactivityTimeout`, etc.
- Socket opts: `noDelay`, `keepAlive`, `enableKeepAliveProbes` - Socket opts: `noDelay`, `keepAlive`, `enableKeepAliveProbes`
- `acme` (IAcmeOptions), `certProvider` (callback) - `acme` (IAcmeOptions), `certProvisionFunction` (callback)
- `useNetworkProxy` (number[]), `networkProxyPort` (number) - `useNetworkProxy` (number[]), `networkProxyPort` (number)
## Troubleshooting ## Troubleshooting

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartproxy', name: '@push.rocks/smartproxy',
version: '10.0.4', version: '10.0.11',
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.' description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.'
} }

View File

@ -77,9 +77,9 @@ export interface IDomainForwardConfig {
* Unified ACME configuration options used across proxies and handlers * Unified ACME configuration options used across proxies and handlers
*/ */
export interface IAcmeOptions { export interface IAcmeOptions {
accountEmail?: string; // Email for Let's Encrypt account
enabled?: boolean; // Whether ACME is enabled enabled?: boolean; // Whether ACME is enabled
port?: number; // Port to listen on for ACME challenges (default: 80) port?: number; // Port to listen on for ACME challenges (default: 80)
contactEmail?: string; // Email for Let's Encrypt account
useProduction?: boolean; // Use production environment (default: staging) useProduction?: boolean; // Use production environment (default: staging)
httpsRedirectPort?: number; // Port to redirect HTTP requests to HTTPS (default: 443) httpsRedirectPort?: number; // Port to redirect HTTP requests to HTTPS (default: 443)
renewThresholdDays?: number; // Days before expiry to renew certificates renewThresholdDays?: number; // Days before expiry to renew certificates
@ -89,5 +89,3 @@ export interface IAcmeOptions {
skipConfiguredCerts?: boolean; // Skip domains with existing certificates skipConfiguredCerts?: boolean; // Skip domains with existing certificates
domainForwards?: IDomainForwardConfig[]; // Domain-specific forwarding configs domainForwards?: IDomainForwardConfig[]; // Domain-specific forwarding configs
} }
export interface IReverseProxyConfig extends plugins.tsclass.network.IReverseProxyConfig {}

View File

@ -1,5 +1,5 @@
export * from './nfttablesproxy/classes.nftablesproxy.js'; export * from './nfttablesproxy/classes.nftablesproxy.js';
export * from './networkproxy/classes.np.networkproxy.js'; export * from './networkproxy/index.js';
export * from './port80handler/classes.port80handler.js'; export * from './port80handler/classes.port80handler.js';
export * from './redirect/classes.redirect.js'; export * from './redirect/classes.redirect.js';
export * from './smartproxy/classes.smartproxy.js'; export * from './smartproxy/classes.smartproxy.js';

View File

@ -357,7 +357,7 @@ export class CertificateManager {
// Build and configure Port80Handler // Build and configure Port80Handler
this.port80Handler = buildPort80Handler({ this.port80Handler = buildPort80Handler({
port: this.options.acme.port, port: this.options.acme.port,
contactEmail: this.options.acme.contactEmail, accountEmail: this.options.acme.accountEmail,
useProduction: this.options.acme.useProduction, useProduction: this.options.acme.useProduction,
httpsRedirectPort: this.options.port, // Redirect to our HTTPS port httpsRedirectPort: this.options.port, // Redirect to our HTTPS port
enabled: this.options.acme.enabled, enabled: this.options.acme.enabled,

View File

@ -76,7 +76,7 @@ export class NetworkProxy implements IMetricsTracker {
acme: { acme: {
enabled: optionsArg.acme?.enabled || false, enabled: optionsArg.acme?.enabled || false,
port: optionsArg.acme?.port || 80, port: optionsArg.acme?.port || 80,
contactEmail: optionsArg.acme?.contactEmail || 'admin@example.com', accountEmail: optionsArg.acme?.accountEmail || 'admin@example.com',
useProduction: optionsArg.acme?.useProduction || false, // Default to staging for safety useProduction: optionsArg.acme?.useProduction || false, // Default to staging for safety
renewThresholdDays: optionsArg.acme?.renewThresholdDays || 30, renewThresholdDays: optionsArg.acme?.renewThresholdDays || 30,
autoRenew: optionsArg.acme?.autoRenew !== false, // Default to true autoRenew: optionsArg.acme?.autoRenew !== false, // Default to true

View File

@ -101,7 +101,7 @@ export class Port80Handler extends plugins.EventEmitter {
// Default options // Default options
this.options = { this.options = {
port: options.port ?? 80, port: options.port ?? 80,
contactEmail: options.contactEmail ?? 'admin@example.com', accountEmail: options.accountEmail ?? 'admin@example.com',
useProduction: options.useProduction ?? false, // Safer default: staging useProduction: options.useProduction ?? false, // Safer default: staging
httpsRedirectPort: options.httpsRedirectPort ?? 443, httpsRedirectPort: options.httpsRedirectPort ?? 443,
enabled: options.enabled ?? true, // Enable by default enabled: options.enabled ?? true, // Enable by default
@ -134,8 +134,8 @@ export class Port80Handler extends plugins.EventEmitter {
// Initialize SmartAcme for ACME challenge management (diskless HTTP handler) // Initialize SmartAcme for ACME challenge management (diskless HTTP handler)
if (this.options.enabled) { if (this.options.enabled) {
this.smartAcme = new plugins.smartacme.SmartAcme({ this.smartAcme = new plugins.smartacme.SmartAcme({
accountEmail: this.options.contactEmail, accountEmail: this.options.accountEmail,
certManager: new plugins.smartacme.MemoryCertManager(), certManager: new plugins.smartacme.certmanagers.MemoryCertManager(),
environment: this.options.useProduction ? 'production' : 'integration', environment: this.options.useProduction ? 'production' : 'integration',
challengeHandlers: [ new DisklessHttp01Handler(this.acmeHttp01Storage) ], challengeHandlers: [ new DisklessHttp01Handler(this.acmeHttp01Storage) ],
challengePriority: ['http-01'], challengePriority: ['http-01'],

View File

@ -2,7 +2,7 @@ import * as plugins from '../plugins.js';
import type { import type {
IConnectionRecord, IConnectionRecord,
IDomainConfig, IDomainConfig,
IPortProxySettings, ISmartProxyOptions,
} from './classes.pp.interfaces.js'; } from './classes.pp.interfaces.js';
import { ConnectionManager } from './classes.pp.connectionmanager.js'; import { ConnectionManager } from './classes.pp.connectionmanager.js';
import { SecurityManager } from './classes.pp.securitymanager.js'; import { SecurityManager } from './classes.pp.securitymanager.js';
@ -17,7 +17,7 @@ import { PortRangeManager } from './classes.pp.portrangemanager.js';
*/ */
export class ConnectionHandler { export class ConnectionHandler {
constructor( constructor(
private settings: IPortProxySettings, private settings: ISmartProxyOptions,
private connectionManager: ConnectionManager, private connectionManager: ConnectionManager,
private securityManager: SecurityManager, private securityManager: SecurityManager,
private domainConfigManager: DomainConfigManager, private domainConfigManager: DomainConfigManager,

View File

@ -1,5 +1,5 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import type { IConnectionRecord, IPortProxySettings } from './classes.pp.interfaces.js'; import type { IConnectionRecord, ISmartProxyOptions } from './classes.pp.interfaces.js';
import { SecurityManager } from './classes.pp.securitymanager.js'; import { SecurityManager } from './classes.pp.securitymanager.js';
import { TimeoutManager } from './classes.pp.timeoutmanager.js'; import { TimeoutManager } from './classes.pp.timeoutmanager.js';
@ -14,7 +14,7 @@ export class ConnectionManager {
} = { incoming: {}, outgoing: {} }; } = { incoming: {}, outgoing: {} };
constructor( constructor(
private settings: IPortProxySettings, private settings: ISmartProxyOptions,
private securityManager: SecurityManager, private securityManager: SecurityManager,
private timeoutManager: TimeoutManager private timeoutManager: TimeoutManager
) {} ) {}

View File

@ -1,5 +1,5 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import type { IDomainConfig, IPortProxySettings } from './classes.pp.interfaces.js'; import type { IDomainConfig, ISmartProxyOptions } from './classes.pp.interfaces.js';
/** /**
* Manages domain configurations and target selection * Manages domain configurations and target selection
@ -8,7 +8,7 @@ export class DomainConfigManager {
// Track round-robin indices for domain configs // Track round-robin indices for domain configs
private domainTargetIndices: Map<IDomainConfig, number> = new Map(); private domainTargetIndices: Map<IDomainConfig, number> = new Map();
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Updates the domain configurations * Updates the domain configurations

View File

@ -22,7 +22,7 @@ export interface IDomainConfig {
/** Port proxy settings including global allowed port ranges */ /** Port proxy settings including global allowed port ranges */
import type { IAcmeOptions } from '../common/types.js'; import type { IAcmeOptions } from '../common/types.js';
export interface IPortProxySettings { export interface ISmartProxyOptions {
fromPort: number; fromPort: number;
toPort: number; toPort: number;
targetIP?: string; // Global target host to proxy to, defaults to 'localhost' targetIP?: string; // Global target host to proxy to, defaults to 'localhost'
@ -91,7 +91,7 @@ export interface IPortProxySettings {
* Optional certificate provider callback. Return 'http01' to use HTTP-01 challenges, * Optional certificate provider callback. Return 'http01' to use HTTP-01 challenges,
* or a static certificate object for immediate provisioning. * or a static certificate object for immediate provisioning.
*/ */
certProvider?: (domain: string) => Promise<ISmartProxyCertProvisionObject>; certProvisionFunction?: (domain: string) => Promise<ISmartProxyCertProvisionObject>;
} }
/** /**

View File

@ -4,7 +4,7 @@ import { Port80Handler } from '../port80handler/classes.port80handler.js';
import { Port80HandlerEvents } from '../common/types.js'; import { Port80HandlerEvents } from '../common/types.js';
import { subscribeToPort80Handler } from '../common/eventUtils.js'; import { subscribeToPort80Handler } from '../common/eventUtils.js';
import type { ICertificateData } from '../common/types.js'; import type { ICertificateData } from '../common/types.js';
import type { IConnectionRecord, IPortProxySettings, IDomainConfig } from './classes.pp.interfaces.js'; import type { IConnectionRecord, ISmartProxyOptions, IDomainConfig } from './classes.pp.interfaces.js';
/** /**
* Manages NetworkProxy integration for TLS termination * Manages NetworkProxy integration for TLS termination
@ -13,7 +13,7 @@ export class NetworkProxyBridge {
private networkProxy: NetworkProxy | null = null; private networkProxy: NetworkProxy | null = null;
private port80Handler: Port80Handler | null = null; private port80Handler: Port80Handler | null = null;
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Set the Port80Handler to use for certificate management * Set the Port80Handler to use for certificate management

View File

@ -1,10 +1,10 @@
import type{ IPortProxySettings } from './classes.pp.interfaces.js'; import type{ ISmartProxyOptions } from './classes.pp.interfaces.js';
/** /**
* Manages port ranges and port-based configuration * Manages port ranges and port-based configuration
*/ */
export class PortRangeManager { export class PortRangeManager {
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Get all ports that should be listened on * Get all ports that should be listened on

View File

@ -1,5 +1,5 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import type { IPortProxySettings } from './classes.pp.interfaces.js'; import type { ISmartProxyOptions } from './classes.pp.interfaces.js';
/** /**
* Handles security aspects like IP tracking, rate limiting, and authorization * Handles security aspects like IP tracking, rate limiting, and authorization
@ -8,7 +8,7 @@ export class SecurityManager {
private connectionsByIP: Map<string, Set<string>> = new Map(); private connectionsByIP: Map<string, Set<string>> = new Map();
private connectionRateByIP: Map<string, number[]> = new Map(); private connectionRateByIP: Map<string, number[]> = new Map();
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Get connections count by IP * Get connections count by IP

View File

@ -1,10 +1,10 @@
import type { IConnectionRecord, IPortProxySettings } from './classes.pp.interfaces.js'; import type { IConnectionRecord, ISmartProxyOptions } from './classes.pp.interfaces.js';
/** /**
* Manages timeouts and inactivity tracking for connections * Manages timeouts and inactivity tracking for connections
*/ */
export class TimeoutManager { export class TimeoutManager {
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Ensure timeout values don't exceed Node.js max safe integer * Ensure timeout values don't exceed Node.js max safe integer

View File

@ -1,5 +1,5 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import type { IPortProxySettings } from './classes.pp.interfaces.js'; import type { ISmartProxyOptions } from './classes.pp.interfaces.js';
import { SniHandler } from './classes.pp.snihandler.js'; import { SniHandler } from './classes.pp.snihandler.js';
/** /**
@ -16,7 +16,7 @@ interface IConnectionInfo {
* Manages TLS-related operations including SNI extraction and validation * Manages TLS-related operations including SNI extraction and validation
*/ */
export class TlsManager { export class TlsManager {
constructor(private settings: IPortProxySettings) {} constructor(private settings: ISmartProxyOptions) {}
/** /**
* Check if a data chunk appears to be a TLS handshake * Check if a data chunk appears to be a TLS handshake

View File

@ -13,8 +13,8 @@ import { CertProvisioner } from './classes.pp.certprovisioner.js';
import type { ICertificateData } from '../common/types.js'; import type { ICertificateData } from '../common/types.js';
import { buildPort80Handler } from '../common/acmeFactory.js'; import { buildPort80Handler } from '../common/acmeFactory.js';
import type { IPortProxySettings, IDomainConfig } from './classes.pp.interfaces.js'; import type { ISmartProxyOptions, IDomainConfig } from './classes.pp.interfaces.js';
export type { IPortProxySettings, IDomainConfig }; export type { ISmartProxyOptions as IPortProxySettings, IDomainConfig };
/** /**
* SmartProxy - Main class that coordinates all components * SmartProxy - Main class that coordinates all components
@ -39,7 +39,7 @@ export class SmartProxy extends plugins.EventEmitter {
// CertProvisioner for unified certificate workflows // CertProvisioner for unified certificate workflows
private certProvisioner?: CertProvisioner; private certProvisioner?: CertProvisioner;
constructor(settingsArg: IPortProxySettings) { constructor(settingsArg: ISmartProxyOptions) {
super(); super();
// Set reasonable defaults for all settings // Set reasonable defaults for all settings
this.settings = { this.settings = {
@ -78,7 +78,7 @@ export class SmartProxy extends plugins.EventEmitter {
this.settings.acme = { this.settings.acme = {
enabled: false, enabled: false,
port: 80, port: 80,
contactEmail: 'admin@example.com', accountEmail: 'admin@example.com',
useProduction: false, useProduction: false,
renewThresholdDays: 30, renewThresholdDays: 30,
autoRenew: true, autoRenew: true,
@ -119,7 +119,7 @@ export class SmartProxy extends plugins.EventEmitter {
/** /**
* The settings for the port proxy * The settings for the port proxy
*/ */
public settings: IPortProxySettings; public settings: ISmartProxyOptions;
/** /**
* Initialize the Port80Handler for ACME certificate management * Initialize the Port80Handler for ACME certificate management
@ -165,7 +165,7 @@ export class SmartProxy extends plugins.EventEmitter {
this.settings.domainConfigs, this.settings.domainConfigs,
this.port80Handler, this.port80Handler,
this.networkProxyBridge, this.networkProxyBridge,
this.settings.certProvider, this.settings.certProvisionFunction,
acme.renewThresholdDays!, acme.renewThresholdDays!,
acme.renewCheckIntervalHours!, acme.renewCheckIntervalHours!,
acme.autoRenew!, acme.autoRenew!,
@ -393,9 +393,9 @@ export class SmartProxy extends plugins.EventEmitter {
for (const domain of domainConfig.domains) { for (const domain of domainConfig.domains) {
if (domain.includes('*')) continue; if (domain.includes('*')) continue;
let provision = 'http01' as string | plugins.tsclass.network.ICert; let provision = 'http01' as string | plugins.tsclass.network.ICert;
if (this.settings.certProvider) { if (this.settings.certProvisionFunction) {
try { try {
provision = await this.settings.certProvider(domain); provision = await this.settings.certProvisionFunction(domain);
} catch (err) { } catch (err) {
console.log(`certProvider error for ${domain}: ${err}`); console.log(`certProvider error for ${domain}: ${err}`);
} }