feat(smart-proxy): add socket-handler relay, fast-path port-only forwarding, metrics and bridge improvements, and various TS/Rust integration fixes
This commit is contained in:
@@ -84,17 +84,15 @@ tap.test('should forward TCP connections correctly', async () => {
|
||||
socket.on('error', reject);
|
||||
});
|
||||
|
||||
// Test data transmission
|
||||
// Test data transmission - wait for welcome message first
|
||||
await new Promise<void>((resolve) => {
|
||||
client.on('data', (data) => {
|
||||
client.once('data', (data) => {
|
||||
const response = data.toString();
|
||||
console.log('Received:', response);
|
||||
expect(response).toContain('Connected to TCP test server');
|
||||
client.end();
|
||||
resolve();
|
||||
});
|
||||
|
||||
client.write('Hello from client');
|
||||
});
|
||||
|
||||
await smartProxy.stop();
|
||||
@@ -146,15 +144,13 @@ tap.test('should handle TLS passthrough correctly', async () => {
|
||||
|
||||
// Test data transmission over TLS
|
||||
await new Promise<void>((resolve) => {
|
||||
client.on('data', (data) => {
|
||||
client.once('data', (data) => {
|
||||
const response = data.toString();
|
||||
console.log('TLS Received:', response);
|
||||
expect(response).toContain('Connected to TLS test server');
|
||||
client.end();
|
||||
resolve();
|
||||
});
|
||||
|
||||
client.write('Hello from TLS client');
|
||||
});
|
||||
|
||||
await smartProxy.stop();
|
||||
@@ -222,15 +218,13 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
});
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
clientA.on('data', (data) => {
|
||||
clientA.once('data', (data) => {
|
||||
const response = data.toString();
|
||||
console.log('Domain A response:', response);
|
||||
expect(response).toContain('Connected to TLS test server');
|
||||
clientA.end();
|
||||
resolve();
|
||||
});
|
||||
|
||||
clientA.write('Hello from domain A');
|
||||
});
|
||||
|
||||
// Test domain B should also use TLS since it's on port 8443
|
||||
@@ -251,7 +245,7 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
});
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
clientB.on('data', (data) => {
|
||||
clientB.once('data', (data) => {
|
||||
const response = data.toString();
|
||||
console.log('Domain B response:', response);
|
||||
// Should be forwarded to TLS server
|
||||
@@ -259,8 +253,6 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
clientB.end();
|
||||
resolve();
|
||||
});
|
||||
|
||||
clientB.write('Hello from domain B');
|
||||
});
|
||||
|
||||
await smartProxy.stop();
|
||||
|
||||
Reference in New Issue
Block a user