feat(exports): export datagram handler types and align tests with updated nftables and route security APIs

This commit is contained in:
2026-04-30 09:05:24 +00:00
parent e806f7257f
commit 2933ee5257
14 changed files with 622 additions and 684 deletions
+14 -8
View File
@@ -150,8 +150,9 @@ tap.skip.test('setup NFTables integration test environment', async () => {
type: 'forward',
forwardingEngine: 'nftables',
targets: [{ host: 'localhost', port: TEST_TCP_PORT }],
nftables: { protocol: 'tcp', ipAllowList: ['127.0.0.1', '::1'] }
nftables: { protocol: 'tcp' }
},
security: { ipAllowList: ['127.0.0.1', '::1'] },
name: 'secure-tcp'
},
@@ -174,7 +175,7 @@ tap.skip.test('setup NFTables integration test environment', async () => {
await smartProxy.start();
console.log('SmartProxy started successfully');
const listeningPorts = smartProxy.getListeningPorts();
const listeningPorts = await smartProxy.getListeningPorts();
console.log(`SmartProxy is listening on ports: ${listeningPorts.join(', ')}`);
} catch (err) {
console.error('Failed to start SmartProxy:', err);
@@ -301,14 +302,19 @@ tap.skip.test('should respect IP allow lists in NFTables', async () => {
tap.skip.test('should get NFTables status', async () => {
const status = await smartProxy.getNfTablesStatus();
const statusKeys = Object.keys(status);
if (!status) {
throw new Error('Expected NFTables status after SmartProxy start');
}
const statusKeys = Object.keys(status.groups);
expect(statusKeys.length).toBeGreaterThan(0);
const firstStatus = status[statusKeys[0]];
expect(firstStatus).toHaveProperty('active');
expect(firstStatus).toHaveProperty('ruleCount');
expect(firstStatus.ruleCount).toHaveProperty('total');
expect(firstStatus.ruleCount).toHaveProperty('added');
const firstStatus = Object.values(status.groups)[0];
if (!firstStatus) {
throw new Error('Expected at least one NFTables rule group');
}
expect(firstStatus.ruleCount).toBeGreaterThan(0);
expect(firstStatus.createdAt).toBeGreaterThan(0);
});
tap.skip.test('cleanup NFTables integration test environment', async () => {