Refactor VPN proxy client implementation
Build and Deploy Gateway / build-and-push (push) Failing after 2s
Build and Deploy Gateway / deploy (push) Has been skipped

This commit is contained in:
2026-08-09 00:41:52 +03:00
parent 32be4380a3
commit 34d8b681ad
190 changed files with 20064 additions and 9761 deletions
+13 -2
View File
@@ -1,8 +1,8 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { parseSubscriptionBody } from '../src/server/subscription.js';
import { createStateSnapshot, normalizeStoredState } from '../src/shared/contracts/state.js';
import { parseSubscriptionBody } from '../dist/server/subscription.js';
import { createStateSnapshot, normalizeStoredState } from '../dist/shared/contracts/state.js';
const outbound = (index) => ({
type: 'vless',
@@ -52,3 +52,14 @@ test('data invariant: one canonical snapshot owns server selection and never exp
assert.equal(snapshot.servers.find((server) => server.id === selectedServerId)?.host, 'vpn-17.example.test');
assert.equal(JSON.stringify(snapshot).includes('private-token'), false);
});
test('persisted numeric IDs and legacy tags keep their previous string normalization', () => {
const stored = normalizeStoredState({
servers: [{ id: '42', label: '7', host: 'vpn.example', port: 443, protocol: 'vless' }],
selectedServerId: 42,
appliedTag: 7,
});
assert.equal(stored.selectedServerId, '42');
assert.equal(stored.appliedServerId, '42');
});