start fixing tests

This commit is contained in:
2025-06-06 07:40:59 +00:00
parent 18d79ac7e1
commit b9be6533ae
15 changed files with 330 additions and 477 deletions

View File

@@ -3,6 +3,7 @@ import { HttpProxy } from '../http-proxy/index.js';
import { setupBidirectionalForwarding } from '../../core/utils/socket-utils.js';
import type { IConnectionRecord, ISmartProxyOptions } from './models/interfaces.js';
import type { IRouteConfig } from './models/route-types.js';
import { WrappedSocket } from '../../core/models/wrapped-socket.js';
export class HttpProxyBridge {
private httpProxy: HttpProxy | null = null;
@@ -98,7 +99,7 @@ export class HttpProxyBridge {
*/
public async forwardToHttpProxy(
connectionId: string,
socket: plugins.net.Socket,
socket: plugins.net.Socket | WrappedSocket,
record: IConnectionRecord,
initialChunk: Buffer,
httpProxyPort: number,
@@ -125,7 +126,10 @@ export class HttpProxyBridge {
}
// Use centralized bidirectional forwarding
setupBidirectionalForwarding(socket, proxySocket, {
// Extract underlying socket if it's a WrappedSocket
const underlyingSocket = socket instanceof WrappedSocket ? socket.socket : socket;
setupBidirectionalForwarding(underlyingSocket, proxySocket, {
onClientData: (chunk) => {
// Update stats if needed
if (record) {