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:
2026-02-09 16:25:33 +00:00
parent 41efdb47f8
commit f7605e042e
17 changed files with 724 additions and 300 deletions

View File

@@ -13,49 +13,26 @@ tap.test('route security should be correctly configured', async () => {
targets: [{
host: '127.0.0.1',
port: 8991
}],
security: {
ipAllowList: ['192.168.1.1'],
ipBlockList: ['10.0.0.1']
}
}]
},
security: {
ipAllowList: ['192.168.1.1'],
ipBlockList: ['10.0.0.1']
}
}];
// This should not throw an error
const proxy = new smartproxy.SmartProxy({
enableDetailedLogging: false,
routes: routes
});
// The proxy should be created successfully
expect(proxy).toBeInstanceOf(smartproxy.SmartProxy);
// Test that security manager exists and has the isIPAuthorized method
const securityManager = (proxy as any).securityManager;
expect(securityManager).toBeDefined();
expect(typeof securityManager.isIPAuthorized).toEqual('function');
// Test IP authorization logic directly
const isLocalhostAllowed = securityManager.isIPAuthorized(
'127.0.0.1',
['192.168.1.1'], // Allow list
[] // Block list
);
expect(isLocalhostAllowed).toBeFalse();
const isAllowedIPAllowed = securityManager.isIPAuthorized(
'192.168.1.1',
['192.168.1.1'], // Allow list
[] // Block list
);
expect(isAllowedIPAllowed).toBeTrue();
const isBlockedIPAllowed = securityManager.isIPAuthorized(
'10.0.0.1',
['0.0.0.0/0'], // Allow all
['10.0.0.1'] // But block this specific IP
);
expect(isBlockedIPAllowed).toBeFalse();
// Verify route configuration was preserved
expect(proxy.settings.routes[0].security?.ipAllowList).toContain('192.168.1.1');
expect(proxy.settings.routes[0].security?.ipBlockList).toContain('10.0.0.1');
});
export default tap.start();
export default tap.start();