This commit is contained in:
Max Schmitt 2024-07-11 22:55:31 +02:00
parent 47bea61680
commit c0c4a27c96

View file

@ -108,6 +108,8 @@ export class MockSocksServer {
host: '127.0.0.1', host: '127.0.0.1',
port: 0, port: 0,
}); });
});
this._socksProxy.addListener(SocksProxy.Events.SocksData, async (payload: SocksSocketRequestedPayload) => {
const body = '<html><title>Served by the SOCKS proxy</title></html>'; const body = '<html><title>Served by the SOCKS proxy</title></html>';
const data = Buffer.from([ const data = Buffer.from([
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
@ -118,6 +120,7 @@ export class MockSocksServer {
body body
].join('\r\n')); ].join('\r\n'));
this._socksProxy.sendSocketData({ uid: payload.uid, data }); this._socksProxy.sendSocketData({ uid: payload.uid, data });
this._socksProxy.sendSocketEnd({ uid: payload.uid });
}); });
} }