BREAKING CHANGE(forwarding): Refactor unified forwarding API and remove redundant documentation. Removed docs/forwarding-system.md (its content is migrated into readme.md) and updated helper functions (e.g. replacing sniPassthrough with httpsPassthrough) to accept configuration objects. Legacy fields in domain configurations (allowedIPs, blockedIPs, useNetworkProxy, networkProxyPort, connectionTimeout) have been removed in favor of forwarding.security and advanced options. Tests and examples have been updated accordingly.

This commit is contained in:
2025-05-09 15:39:15 +00:00
parent f00bae4631
commit 1a902a04fb
20 changed files with 441 additions and 434 deletions

View File

@ -16,11 +16,13 @@ tap.test('Forwarding configuration examples', async (tools) => {
// Example 1: HTTP-only configuration
const httpOnlyConfig: IDomainConfig = {
domains: ['http.example.com'],
allowedIPs: [],
forwarding: httpOnly({
target: {
host: 'localhost',
port: 3000
},
security: {
allowedIps: ['*'] // Allow all
}
})
};
@ -30,11 +32,13 @@ tap.test('Forwarding configuration examples', async (tools) => {
// Example 2: HTTPS Passthrough (SNI)
const httpsPassthroughConfig: IDomainConfig = {
domains: ['pass.example.com'],
allowedIPs: [],
forwarding: httpsPassthrough({
target: {
host: ['10.0.0.1', '10.0.0.2'], // Round-robin target IPs
port: 443
},
security: {
allowedIps: ['*'] // Allow all
}
})
};
@ -45,7 +49,6 @@ tap.test('Forwarding configuration examples', async (tools) => {
// Example 3: HTTPS Termination to HTTP Backend
const terminateToHttpConfig: IDomainConfig = {
domains: ['secure.example.com'],
allowedIPs: [],
forwarding: tlsTerminateToHttp({
target: {
host: 'localhost',
@ -61,6 +64,9 @@ tap.test('Forwarding configuration examples', async (tools) => {
enabled: true,
maintenance: true,
production: false // Use staging ACME server for testing
},
security: {
allowedIps: ['*'] // Allow all
}
})
};
@ -71,7 +77,6 @@ tap.test('Forwarding configuration examples', async (tools) => {
// Example 4: HTTPS Termination to HTTPS Backend
const terminateToHttpsConfig: IDomainConfig = {
domains: ['proxy.example.com'],
allowedIPs: [],
forwarding: tlsTerminateToHttps({
target: {
host: 'internal-api.local',