feat(smartproxy): Update documentation and route helper functions; add createPortRange, createSecurityConfig, createStaticFileRoute, and createTestRoute helpers to the readme and tests. Refactor test examples to use the new helper API and remove legacy connection handling files (including the old connection handler and PortRangeManager) to fully embrace the unified route‐based configuration.

This commit is contained in:
2025-05-10 07:34:35 +00:00
parent 36bea96ac7
commit b4a0e4be6b
14 changed files with 458 additions and 193 deletions

View File

@ -741,20 +741,7 @@ export class RouteConnectionHandler {
this.connectionManager.incrementTerminationStat('outgoing', 'connection_failed');
}
// If we have a forwarding handler for this domain, let it handle the error
if (domainConfig) {
try {
const forwardingHandler = this.domainConfigManager.getForwardingHandler(domainConfig);
forwardingHandler.emit('connection_error', {
socket,
error: err,
connectionId
});
} catch (handlerErr) {
// If getting the handler fails, just log and continue with normal cleanup
console.log(`Error getting forwarding handler for error handling: ${handlerErr}`);
}
}
// Route-based configuration doesn't use domain handlers
// Clean up the connection
this.connectionManager.initiateCleanupOnce(record, `connection_failed_${code}`);
@ -887,8 +874,8 @@ export class RouteConnectionHandler {
`${
serverName
? ` (SNI: ${serverName})`
: domainConfig
? ` (Port-based for domain: ${domainConfig.domains.join(', ')})`
: record.lockedDomain
? ` (Domain: ${record.lockedDomain})`
: ''
}` +
` TLS: ${record.isTLS ? 'Yes' : 'No'}, Keep-Alive: ${
@ -901,8 +888,8 @@ export class RouteConnectionHandler {
`${
serverName
? ` (SNI: ${serverName})`
: domainConfig
? ` (Port-based for domain: ${domainConfig.domains.join(', ')})`
: record.lockedDomain
? ` (Domain: ${record.lockedDomain})`
: ''
}`
);