Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
e8a539829a | |||
a646f4ad28 | |||
aa70dcc299 | |||
adb85d920f | |||
2e4c6312cd | |||
9b773608c7 |
18
changelog.md
18
changelog.md
@ -1,5 +1,23 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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)
|
## 2025-05-04 - 10.0.7 - fix(core)
|
||||||
refactor: Rename IPortProxySettings to ISmartProxyOptions in internal modules
|
refactor: Rename IPortProxySettings to ISmartProxyOptions in internal modules
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartproxy",
|
"name": "@push.rocks/smartproxy",
|
||||||
"version": "10.0.7",
|
"version": "10.0.10",
|
||||||
"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",
|
||||||
|
@ -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
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartproxy',
|
name: '@push.rocks/smartproxy',
|
||||||
version: '10.0.7',
|
version: '10.0.10',
|
||||||
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.'
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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,
|
||||||
|
@ -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
|
||||||
|
@ -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,7 +134,7 @@ 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.MemoryCertManager(),
|
||||||
environment: this.options.useProduction ? 'production' : 'integration',
|
environment: this.options.useProduction ? 'production' : 'integration',
|
||||||
challengeHandlers: [ new DisklessHttp01Handler(this.acmeHttp01Storage) ],
|
challengeHandlers: [ new DisklessHttp01Handler(this.acmeHttp01Storage) ],
|
||||||
|
@ -91,7 +91,7 @@ export interface ISmartProxyOptions {
|
|||||||
* 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>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
@ -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}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user