Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
8ddffcd6e5 | |||
a5a7781c17 | |||
d647e77cdf | |||
9161336197 |
11
changelog.md
11
changelog.md
@ -1,5 +1,16 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-03-01 - 3.20.2 - fix(PortProxy)
|
||||||
|
Enhance connection cleanup handling in PortProxy
|
||||||
|
|
||||||
|
- Add checks to ensure timers are reset only if outgoing socket is active
|
||||||
|
- Prevent setting outgoingActive if the connection is already closed
|
||||||
|
|
||||||
|
## 2025-03-01 - 3.20.1 - fix(PortProxy)
|
||||||
|
Improve IP allowance check for forced domains
|
||||||
|
|
||||||
|
- Enhanced IP allowance check logic by incorporating blocked IPs and default allowed IPs for forced domains within port proxy configurations.
|
||||||
|
|
||||||
## 2025-03-01 - 3.20.0 - feat(PortProxy)
|
## 2025-03-01 - 3.20.0 - feat(PortProxy)
|
||||||
Enhance PortProxy with advanced connection cleanup and logging
|
Enhance PortProxy with advanced connection cleanup and logging
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartproxy",
|
"name": "@push.rocks/smartproxy",
|
||||||
"version": "3.20.0",
|
"version": "3.20.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.",
|
"description": "A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartproxy',
|
name: '@push.rocks/smartproxy',
|
||||||
version: '3.20.0',
|
version: '3.20.2',
|
||||||
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.'
|
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.'
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,7 @@ export class PortProxy {
|
|||||||
|
|
||||||
// Initialize a cleanup timer for max connection lifetime.
|
// Initialize a cleanup timer for max connection lifetime.
|
||||||
if (this.settings.maxConnectionLifetime) {
|
if (this.settings.maxConnectionLifetime) {
|
||||||
|
// Flags to track if data was seen from each side.
|
||||||
let incomingActive = false;
|
let incomingActive = false;
|
||||||
let outgoingActive = false;
|
let outgoingActive = false;
|
||||||
const resetCleanupTimer = () => {
|
const resetCleanupTimer = () => {
|
||||||
@ -370,15 +371,19 @@ export class PortProxy {
|
|||||||
|
|
||||||
resetCleanupTimer();
|
resetCleanupTimer();
|
||||||
|
|
||||||
|
// Only reset the timer if outgoing socket is still active.
|
||||||
socket.on('data', () => {
|
socket.on('data', () => {
|
||||||
incomingActive = true;
|
incomingActive = true;
|
||||||
if (incomingActive && outgoingActive) {
|
// Check if outgoing has not been closed before resetting timer.
|
||||||
|
if (!connectionRecord.outgoingClosedTime && incomingActive && outgoingActive) {
|
||||||
resetCleanupTimer();
|
resetCleanupTimer();
|
||||||
incomingActive = false;
|
incomingActive = false;
|
||||||
outgoingActive = false;
|
outgoingActive = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
targetSocket.on('data', () => {
|
targetSocket.on('data', () => {
|
||||||
|
// If outgoing is closed, do not set outgoingActive.
|
||||||
|
if (connectionRecord.outgoingClosedTime) return;
|
||||||
outgoingActive = true;
|
outgoingActive = true;
|
||||||
if (incomingActive && outgoingActive) {
|
if (incomingActive && outgoingActive) {
|
||||||
resetCleanupTimer();
|
resetCleanupTimer();
|
||||||
@ -413,7 +418,15 @@ export class PortProxy {
|
|||||||
domain => domain.portRanges && domain.portRanges.length > 0 && isPortInRanges(localPort, domain.portRanges)
|
domain => domain.portRanges && domain.portRanges.length > 0 && isPortInRanges(localPort, domain.portRanges)
|
||||||
);
|
);
|
||||||
if (forcedDomain) {
|
if (forcedDomain) {
|
||||||
if (!isAllowed(remoteIP, forcedDomain.allowedIPs)) {
|
const effectiveAllowedIPs: string[] = [
|
||||||
|
...forcedDomain.allowedIPs,
|
||||||
|
...(this.settings.defaultAllowedIPs || [])
|
||||||
|
];
|
||||||
|
const effectiveBlockedIPs: string[] = [
|
||||||
|
...(forcedDomain.blockedIPs || []),
|
||||||
|
...(this.settings.defaultBlockedIPs || [])
|
||||||
|
];
|
||||||
|
if (!isGlobIPAllowed(remoteIP, effectiveAllowedIPs, effectiveBlockedIPs)) {
|
||||||
console.log(`Connection from ${remoteIP} rejected: IP not allowed for domain ${forcedDomain.domains.join(', ')} on port ${localPort}.`);
|
console.log(`Connection from ${remoteIP} rejected: IP not allowed for domain ${forcedDomain.domains.join(', ')} on port ${localPort}.`);
|
||||||
socket.end();
|
socket.end();
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user