Add IP routing rules and fix gRPC buffer retention
This commit is contained in:
@@ -46,9 +46,11 @@ const subscriptionConfig = {
|
||||
test('gateway preserves mixed user-rule order and dynamic VPN target', () => {
|
||||
const config = buildGatewayConfig(subscriptionConfig, 'test-vpn', {
|
||||
routeRules: [
|
||||
{ type: 'ip_cidr', value: '2001:0DB8:0:0::1', enabled: true, outbound: 'direct' },
|
||||
{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' },
|
||||
{ type: 'domain_suffix', value: 'example.com', enabled: true, outbound: 'direct' },
|
||||
{ type: 'domain_keyword', value: 'disabled', enabled: false, outbound: 'vpn' },
|
||||
{ type: 'ip_cidr', value: '203.0.113.25', enabled: false, outbound: 'direct' },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -73,6 +75,7 @@ test('gateway preserves mixed user-rule order and dynamic VPN target', () => {
|
||||
timeout: '1s',
|
||||
},
|
||||
{ inbound: ['diagnostics-vpn-in'], outbound: 'test-vpn' },
|
||||
{ ip_cidr: ['2001:db8::1'], outbound: 'direct' },
|
||||
{ domain: ['api.example.com'], outbound: 'test-vpn' },
|
||||
{ domain_suffix: ['example.com'], outbound: 'direct' },
|
||||
{ inbound: ['tproxy-in'], outbound: 'test-vpn' },
|
||||
@@ -91,7 +94,11 @@ test('gateway dual-channel config fixes probes to role tags and keeps inbound co
|
||||
primary: { subscriptionConfig: primaryConfig, selectedServerId: 'same-provider-tag' },
|
||||
reserve: { subscriptionConfig: reserveConfig, selectedServerId: 'same-provider-tag' },
|
||||
}, {
|
||||
routeRules: [{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' }],
|
||||
routeRules: [
|
||||
{ type: 'ip_cidr', value: '203.0.113.25', enabled: true, outbound: 'direct' },
|
||||
{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' },
|
||||
{ type: 'ip_cidr', value: '2001:db8::1', enabled: true, outbound: 'vpn' },
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepEqual(config.outbounds.map(({ tag }) => tag), [
|
||||
@@ -104,11 +111,13 @@ test('gateway dual-channel config fixes probes to role tags and keeps inbound co
|
||||
default: 'channel-primary',
|
||||
interrupt_exist_connections: false,
|
||||
});
|
||||
assert.deepEqual(config.route.rules.slice(1, 5), [
|
||||
assert.deepEqual(config.route.rules.slice(1, 7), [
|
||||
{ inbound: ['diagnostics-primary-in'], outbound: 'channel-primary' },
|
||||
{ inbound: ['diagnostics-reserve-in'], outbound: 'channel-reserve' },
|
||||
{ inbound: ['diagnostics-vpn-in'], outbound: 'channel-selector' },
|
||||
{ ip_cidr: ['203.0.113.25'], outbound: 'direct' },
|
||||
{ domain: ['api.example.com'], outbound: 'channel-selector' },
|
||||
{ ip_cidr: ['2001:db8::1'], outbound: 'channel-selector' },
|
||||
]);
|
||||
assert.equal(config.route.final, 'channel-selector');
|
||||
const restoredReserve = buildDualChannelGatewayConfig({
|
||||
|
||||
Reference in New Issue
Block a user