Improve VPN client connection management
Build and Deploy Gateway / build-and-push (push) Successful in 20s
Build and Deploy Gateway / deploy (push) Successful in 13s

This commit is contained in:
2026-08-12 21:48:37 +03:00
parent 068a7f9890
commit 9e52ccc24d
22 changed files with 962 additions and 76 deletions
+10 -1
View File
@@ -43,11 +43,13 @@ test('Grafana dashboard uses one all-or-one device scope and shows active device
const domains = dashboard.panels.find(({ id }) => id === 9);
const totalTraffic = dashboard.panels.find(({ id }) => id === 1);
const trafficBySource = dashboard.panels.find(({ id }) => id === 4);
const singboxOutbounds = dashboard.panels.find(({ id }) => id === 15);
const directPackets = dashboard.panels.find(({ id }) => id === 16);
const speedPanels = [globalSpeed, deviceSpeed, sourceSpeed];
assert.equal(dashboard.title, 'Harbor Gateway: трафик');
assert.equal(dashboard.refresh, '30s');
assert.equal(dashboard.version, 7);
assert.equal(dashboard.version, 8);
assert.deepEqual(titles.filter((title) => ['Обзор', 'Устройства', 'Сервисы и домены', 'Техническая детализация'].includes(title)), [
'Обзор',
'Устройства',
@@ -63,10 +65,16 @@ test('Grafana dashboard uses one all-or-one device scope and shows active device
assert.ok(titles.includes('Домены за выбранный период'));
assert.ok(titles.includes('Весь Harbor за выбранный период'));
assert.ok(titles.includes('Источники за выбранный период'));
assert.ok(titles.includes('sing-box: VPN / Direct за выбранный период'));
assert.ok(titles.includes('Gateway Direct: IPv4-пакеты за выбранный период'));
assert.ok(expressions.some((expression) => expression.includes('harbor_traffic_bytes_total')));
assert.ok(expressions.some((expression) => expression.includes('harbor_device_traffic_bytes_total')));
assert.ok(expressions.some((expression) => expression.includes('harbor_device_domain_traffic_bytes_total{device_id=~"$device_id"}[$__range]')));
assert.ok(expressions.some((expression) => expression.includes('harbor_domain_traffic_last_observed_timestamp_seconds')));
assert.ok(expressions.some((expression) => expression.includes('harbor_direct_ipv4_packet_last_observed_timestamp_seconds')));
assert.match(singboxOutbounds.targets[0].expr, /sum by \(outbound, source\).*harbor_singbox_tracked_bytes_total\[\$__range\]/);
assert.match(directPackets.targets[0].expr, /sum by \(direction\).*harbor_direct_ipv4_packet_bytes_total\[\$__range\]/);
assert.match(directPackets.description, /нельзя складывать с sing-box tracker bytes/);
assert.match(topDevices.targets[0].expr, /^topk\(10,[\s\S]*increase\(harbor_device_traffic_bytes_total\[\$__range\]\)[\s\S]*> 0[\s\S]*group_left \(name, ip\)/);
assert.equal(topDevices.options.sortBy[0].desc, true);
assert.match(topDevices.fieldConfig.overrides[1].properties[0].value[0].url, /var-device_id=\$\{__data\.fields/);
@@ -74,6 +82,7 @@ test('Grafana dashboard uses one all-or-one device scope and shows active device
assert.deepEqual(freshness.fieldConfig.defaults.thresholds.steps.map(({ value }) => value), [null, 60, 120]);
assert.equal(freshness.fieldConfig.defaults.noValue, 'Нет данных');
assert.equal(freshness.title, 'Свежесть данных в конце выбранного периода');
assert.equal(freshness.targets.find(({ refId }) => refId === 'C').legendFormat, 'Gateway Direct');
assert.equal(deviceVariable.name, 'device_id');
assert.equal(deviceVariable.multi, false);
assert.equal(deviceVariable.includeAll, true);