import type { ManagedNodeInfo } from '../orchestrator/types.js'; /** * The shortest gap between two address restarts of one node. Bounds a flapping * router (a mapping that keeps failing and coming back) to one restart per node * per window; a difference found inside the window waits for the first check * after it ends. */ export declare const NAT_ADDRESS_RESTART_MIN_INTERVAL_MS: number; /** Asked to restart one node so it starts announcing its current public addresses. */ export type NodeAddressesStaleListener = (nodeId: string) => void | Promise; /** * Notices a running node whose announced public addresses differ from the ones * it should announce now, and asks its listeners to restart that node. A node * learns its public addresses only at start (`CADRE_APPEND_ANNOUNCE_ADDRS`), so * a restart is how a changed mapping, forward, DDNS hostname or external IP * reaches it. */ export declare class AddressWatch { private readonly now; private readonly listeners; /** When each node was last asked to restart (ms since epoch). */ private readonly lastRestartAt; constructor(now: () => number); /** Register a restart listener. Returns an unsubscribe fn. */ subscribe(listener: NodeAddressesStaleListener): () => void; /** * Compare every running node's announced addresses with `expected(node)`, as * sets, and ask for a restart of each that differs and was not restarted * within {@link NAT_ADDRESS_RESTART_MIN_INTERVAL_MS}. */ check(nodes: ManagedNodeInfo[], expected: (node: ManagedNodeInfo) => string[]): void; /** A terminated node's id may come back as a fresh node, which owes nothing to the old window. */ private forgetMissing; private restartedRecently; /** Fire-and-forget: a restart takes seconds and must not hold up the NAT pass that found it. */ private notify; }