Update Harbor client and gateway functionality
This commit is contained in:
@@ -21,12 +21,12 @@ const subscriptionConfig = {
|
||||
}],
|
||||
};
|
||||
|
||||
test('client exposes one local proxy and routes local exceptions before the selected VPN', () => {
|
||||
test('client exposes one local proxy and preserves mixed user-rule order before fallback', () => {
|
||||
const config = buildGatewayConfig(subscriptionConfig, 'test-vpn', {
|
||||
routeRules: [
|
||||
{ type: 'domain_suffix', value: 'ru', enabled: true },
|
||||
{ type: 'domain', value: 'example.com', enabled: true },
|
||||
{ type: 'domain_keyword', value: 'cdn', enabled: false },
|
||||
{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' },
|
||||
{ type: 'domain_suffix', value: 'example.com', enabled: true, outbound: 'direct' },
|
||||
{ type: 'domain_keyword', value: 'cdn', enabled: false, outbound: 'vpn' },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -44,8 +44,8 @@ test('client exposes one local proxy and routes local exceptions before the sele
|
||||
timeout: '1s',
|
||||
},
|
||||
{ inbound: ['diagnostics-vpn-in'], outbound: 'test-vpn' },
|
||||
{ domain_suffix: ['ru'], outbound: 'direct' },
|
||||
{ domain: ['example.com'], outbound: 'direct' },
|
||||
{ domain: ['api.example.com'], outbound: 'test-vpn' },
|
||||
{ domain_suffix: ['example.com'], outbound: 'direct' },
|
||||
{ inbound: ['mixed-in'], outbound: 'test-vpn' },
|
||||
]);
|
||||
assert.equal(config.route.final, 'test-vpn');
|
||||
@@ -55,7 +55,10 @@ test('client exposes one local proxy and routes local exceptions before the sele
|
||||
test('client keeps its local proxy but routes directly when Harbor Gateway is ahead', () => {
|
||||
const config = buildGatewayConfig(subscriptionConfig, 'test-vpn', {
|
||||
clientDirect: true,
|
||||
routeRules: [{ type: 'domain_suffix', value: 'ru', enabled: true }],
|
||||
routeRules: [
|
||||
{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' },
|
||||
{ type: 'domain_suffix', value: 'example.com', enabled: true, outbound: 'direct' },
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepEqual(config.route.rules, [
|
||||
@@ -66,9 +69,9 @@ test('client keeps its local proxy but routes directly when Harbor Gateway is ah
|
||||
timeout: '1s',
|
||||
},
|
||||
{ inbound: ['diagnostics-vpn-in'], outbound: 'test-vpn' },
|
||||
{ domain_suffix: ['ru'], outbound: 'direct' },
|
||||
{ inbound: ['mixed-in'], outbound: 'direct' },
|
||||
]);
|
||||
assert.equal(config.route.final, 'direct');
|
||||
assert.deepEqual(config.outbounds.map((outbound) => outbound.tag), ['test-vpn', 'direct']);
|
||||
assert.equal(config.route.rules.some((rule) => Object.keys(rule).some((key) => key.startsWith('domain'))), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user