Add enabled local routing rules and gateway version reporting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BUILT_IN_DIRECT_RULES, normalizeRouteRules } from '../routingRules.js';
|
||||
import { normalizeRouteRules } from '../routingRules.js';
|
||||
|
||||
const MODES = new Set(['client', 'gateway']);
|
||||
const CONNECTION_STATES = new Set(['running', 'stopped']);
|
||||
@@ -83,10 +83,7 @@ export function createStateSnapshot({
|
||||
gatewayAddress: mode === 'client' ? gatewayAuto?.gateway?.gateway || null : null,
|
||||
lastVerifiedAt: null,
|
||||
reason: mode === 'client' && stored.gatewayAutoEnabled !== false ? 'auto' : 'manual',
|
||||
localRules: {
|
||||
builtIn: BUILT_IN_DIRECT_RULES.map((rule) => ({ ...rule })),
|
||||
custom: stored.routeRules,
|
||||
},
|
||||
localRules: stored.routeRules,
|
||||
},
|
||||
operation: {
|
||||
kind: nullableText(operation.kind),
|
||||
@@ -147,7 +144,8 @@ export function assertStateSnapshot(snapshot) {
|
||||
rule &&
|
||||
['domain', 'domain_suffix', 'domain_keyword'].includes(rule.type) &&
|
||||
typeof rule.value === 'string' &&
|
||||
Boolean(rule.value)
|
||||
Boolean(rule.value) &&
|
||||
typeof rule.enabled === 'boolean'
|
||||
);
|
||||
|
||||
if (
|
||||
@@ -177,11 +175,8 @@ export function assertStateSnapshot(snapshot) {
|
||||
!nullableString(snapshot.route.gatewayAddress) ||
|
||||
!nullableDate(snapshot.route.lastVerifiedAt) ||
|
||||
typeof snapshot.route.reason !== 'string' ||
|
||||
!snapshot.route.localRules ||
|
||||
!Array.isArray(snapshot.route.localRules.builtIn) ||
|
||||
!snapshot.route.localRules.builtIn.every(validRouteRule) ||
|
||||
!Array.isArray(snapshot.route.localRules.custom) ||
|
||||
!snapshot.route.localRules.custom.every(validRouteRule) ||
|
||||
!Array.isArray(snapshot.route.localRules) ||
|
||||
!snapshot.route.localRules.every(validRouteRule) ||
|
||||
!snapshot.operation ||
|
||||
!nullableString(snapshot.operation.kind) ||
|
||||
!OPERATION_STATES.has(snapshot.operation.status) ||
|
||||
|
||||
Reference in New Issue
Block a user