fix(smartproxy): Improve port binding intelligence and ACME challenge route management; update route configuration tests and dependency versions.

This commit is contained in:
2025-05-28 19:58:28 +00:00
parent 4ebaf6c061
commit 742adc2bd9
17 changed files with 948 additions and 1258 deletions

View File

@ -1,6 +1,6 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import { RouteConnectionHandler } from '../ts/proxies/smart-proxy/route-connection-handler.js';
import { ISmartProxyOptions } from '../ts/proxies/smart-proxy/models/interfaces.js';
import type { ISmartProxyOptions } from '../ts/proxies/smart-proxy/models/interfaces.js';
import * as net from 'net';
// Direct test of the fix in RouteConnectionHandler
@ -68,9 +68,9 @@ tap.test('should detect and forward non-TLS connections on useHttpProxy ports',
};
// Test: Create a mock socket representing non-TLS connection on port 8080
const mockSocket = new net.Socket();
mockSocket.localPort = 8080;
mockSocket.remoteAddress = '127.0.0.1';
const mockSocket = Object.create(net.Socket.prototype) as net.Socket;
Object.defineProperty(mockSocket, 'localPort', { value: 8080, writable: false });
Object.defineProperty(mockSocket, 'remoteAddress', { value: '127.0.0.1', writable: false });
// Simulate the handler processing the connection
handler.handleConnection(mockSocket);
@ -147,9 +147,9 @@ tap.test('should handle TLS connections normally', async (tapTest) => {
mockRouteManager as any
);
const mockSocket = new net.Socket();
mockSocket.localPort = 443;
mockSocket.remoteAddress = '127.0.0.1';
const mockSocket = Object.create(net.Socket.prototype) as net.Socket;
Object.defineProperty(mockSocket, 'localPort', { value: 443, writable: false });
Object.defineProperty(mockSocket, 'remoteAddress', { value: '127.0.0.1', writable: false });
handler.handleConnection(mockSocket);