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

@ -38,22 +38,30 @@ async function main() {
// Example 1: HTTP-only forwarding
await domainManager.addDomainConfig(
createDomainConfig('example.com', helpers.httpOnly('localhost', 3000))
createDomainConfig('example.com', helpers.httpOnly({
target: { host: 'localhost', port: 3000 }
}))
);
// Example 2: HTTPS termination with HTTP backend
await domainManager.addDomainConfig(
createDomainConfig('secure.example.com', helpers.tlsTerminateToHttp('localhost', 3000))
createDomainConfig('secure.example.com', helpers.tlsTerminateToHttp({
target: { host: 'localhost', port: 3000 }
}))
);
// Example 3: HTTPS termination with HTTPS backend
await domainManager.addDomainConfig(
createDomainConfig('api.example.com', helpers.tlsTerminateToHttps('localhost', 8443))
createDomainConfig('api.example.com', helpers.tlsTerminateToHttps({
target: { host: 'localhost', port: 8443 }
}))
);
// Example 4: SNI passthrough
await domainManager.addDomainConfig(
createDomainConfig('passthrough.example.com', helpers.sniPassthrough('10.0.0.5', 443))
createDomainConfig('passthrough.example.com', helpers.sniPassthrough({
target: { host: '10.0.0.5', port: 443 }
}))
);
// Example 5: Custom configuration for a more complex setup