From 6181065963824fadb3eb0a90f30187360b51f096 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 21 Feb 2025 19:53:19 +0000 Subject: [PATCH] fix(smartproxy.portproxy): Optimize SNI handling by simplifying context creation --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/smartproxy.portproxy.ts | 11 +++-------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index ab95197..0f1a16b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-02-21 - 3.7.1 - fix(smartproxy.portproxy) +Optimize SNI handling by simplifying context creation + +- Removed unnecessary SecureContext creation for SNI requests in PortProxy +- Improved handling of SNI passthrough by acknowledging requests without context creation + ## 2025-02-21 - 3.7.0 - feat(PortProxy) Add optional source IP preservation support in PortProxy diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 45329ca..de84665 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartproxy', - version: '3.7.0', + version: '3.7.1', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.portproxy.ts b/ts/smartproxy.portproxy.ts index 94074a2..b6725fd 100644 --- a/ts/smartproxy.portproxy.ts +++ b/ts/smartproxy.portproxy.ts @@ -73,14 +73,9 @@ export class PortProxy { ...this.settings, SNICallback: (serverName: string, cb: (err: Error | null, ctx?: plugins.tls.SecureContext) => void) => { console.log(`SNI request for domain: ${serverName}`); - const domainConfig = findMatchingDomain(serverName); - if (!domainConfig) { - // Always allow SNI for default IPs, even if domain doesn't match - console.log(`SNI domain ${serverName} not found, will check IP during connection`); - } - // Create context with the provided TLS settings - const ctx = plugins.tls.createSecureContext(this.settings); - cb(null, ctx); + // For SNI passthrough, we don't need to create a context + // Just acknowledge the SNI request and continue + cb(null); } }) : plugins.net.createServer();