Refactor VPN proxy client implementation
This commit is contained in:
@@ -10,9 +10,9 @@ import {
|
||||
assertStateSnapshot,
|
||||
createStateSnapshot,
|
||||
normalizeStoredState,
|
||||
} from '../../src/shared/contracts/state.js';
|
||||
import { createServerId } from '../../src/shared/serverIdentity.js';
|
||||
import { HARBOR_VERSIONS } from '../../src/shared/versions.js';
|
||||
} from '../../dist/shared/contracts/state.js';
|
||||
import { createServerId } from '../../dist/shared/serverIdentity.js';
|
||||
import { HARBOR_VERSIONS } from '../../dist/shared/versions.js';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '../..');
|
||||
|
||||
@@ -113,7 +113,7 @@ test('startup discards a rejected cached subscription and returns to first-run',
|
||||
}));
|
||||
fs.writeFileSync(path.join(dir, 'sing-box-config.json'), '{}');
|
||||
|
||||
const child = spawn(process.execPath, ['src/server/index.js'], {
|
||||
const child = spawn(process.execPath, ['dist/server/main.js'], {
|
||||
cwd: root,
|
||||
env: {
|
||||
...process.env,
|
||||
@@ -254,7 +254,7 @@ setInterval(() => {}, 60_000);
|
||||
}));
|
||||
|
||||
const port = await freePort();
|
||||
const child = spawn(process.execPath, ['src/server/index.js'], {
|
||||
const child = spawn(process.execPath, ['dist/server/main.js'], {
|
||||
cwd: root,
|
||||
env: {
|
||||
...process.env,
|
||||
@@ -294,6 +294,29 @@ setInterval(() => {}, 60_000);
|
||||
assert.equal(initial.route.localRulesPendingRestart, false);
|
||||
assert.equal(JSON.stringify(initial).includes(subscriptionUrl), false);
|
||||
const stateKeys = Object.keys(initial).sort();
|
||||
assert.deepEqual(stateKeys, [
|
||||
'apiVersion',
|
||||
'configExists',
|
||||
'connection',
|
||||
'fetchedAt',
|
||||
'gatewayAuto',
|
||||
'generatedAt',
|
||||
'hasSubscription',
|
||||
'mode',
|
||||
'operation',
|
||||
'port',
|
||||
'proxyPort',
|
||||
'revision',
|
||||
'route',
|
||||
'selectedTag',
|
||||
'selection',
|
||||
'servers',
|
||||
'singboxRunning',
|
||||
'singboxStartedAt',
|
||||
'subscription',
|
||||
'subscriptionHost',
|
||||
'userInfo',
|
||||
]);
|
||||
let revision = initial.revision;
|
||||
let rulesRevision = initial.route.localRulesRevision;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user