fix(PortProxy): Fixed indentation issue and ensured proper cleanup of sockets in PortProxy

This commit is contained in:
Philipp Kunz 2025-02-21 18:48:39 +00:00
parent 2be1c57dd7
commit 70f69ef1ea
3 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2025-02-21 - 3.4.3 - fix(PortProxy)
Fixed indentation issue and ensured proper cleanup of sockets in PortProxy
- Fixed inconsistent indentation in IP allowance check.
- Ensured proper cleanup of sockets on connection end in PortProxy.
## 2025-02-21 - 3.4.2 - fix(smartproxy)
Enhance SSL/TLS handling with SNI and error logging

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartproxy',
version: '3.4.2',
version: '3.4.3',
description: 'a proxy for handling high workloads of proxying'
}

View File

@ -113,10 +113,10 @@ export class PortProxy {
}
}
} else if (!this.settings.defaultAllowedIPs || !isAllowed(remoteIP, this.settings.defaultAllowedIPs)) {
console.log(`Connection rejected: IP ${remoteIP} not allowed for non-SNI connection`);
from.end();
return;
}
console.log(`Connection rejected: IP ${remoteIP} not allowed for non-SNI connection`);
from.end();
return;
}
const to = plugins.net.createConnection({
host: this.settings.toHost!,
@ -150,6 +150,8 @@ export class PortProxy {
to.on('end', () => {
cleanUpSockets(from, to);
});
};
this.netServer = server
.on('connection', handleConnection)
.on('secureConnection', handleConnection)