/** * What the QR code of a node waiting to be claimed carries, and the address list behind it. * `HostedNodeService.claimDetails` reads the child's `/status` and hands it here. */ import type { ClaimAddressSettings } from '../installer/config.js'; import type { NetworkMode, NodeReachability } from '../nat/types.js'; import type { NodeStatus } from './node-status.js'; /** What `claimDetails` answers: the QR payload and its parts. */ export interface ClaimDetails { /** `encodeNodeClaimPayload` of the three fields below — the text the QR code carries. */ payload: string; peerId: string; /** Public names (or public IPs when there is no name), then the one LAN address; see {@link dialAddressesFor}. */ multiaddrs: string[]; /** The NAT layer's verdict for the node, or null when it has no entry yet. A phone at home reaches the LAN address either way. */ reachability: NodeReachability | null; } /** The NAT layer's answers the claim details need. `NatService` satisfies this. */ export interface HostedNodeAddressSource { /** The node's public multiaddrs (no `/p2p/` suffix), TCP then WebSocket. */ publicAddressesFor(nodeId: string, ports: { p2p: number; ws?: number; }): string[]; /** * `gateway.lanAddress` is this machine's address on the router's subnet, when a UPnP gateway * answered; `network.mode` is whether it sits behind a router (`lan`) or holds a public IPv4. */ getStatus(): { nodes: NodeReachability[]; gateway: { lanAddress: string | null; }; network: { mode: NetworkMode; }; }; } /** One node's claim details, from its record's secret, its `/status`, and its ports. */ export interface ClaimDetailsInput { id: string; secret: string; status: NodeStatus; /** The orchestrator handle's ports; absent, the code carries LAN addresses only. */ ports: { p2p: number; ws?: number; } | undefined; addresses: HostedNodeAddressSource; /** `host.config.json`'s `claimAddresses.addrs`: exact addresses replacing the automatic choice. */ exactAddrs?: readonly string[]; /** The LAN address to keep, as {@link claimLanAddress} resolved it. */ lan: string | null | undefined; } /** * The claim details for a node whose `/status` answered. `503 node_unavailable` while the * node reports no address a phone could dial (callers poll). */ export declare function buildClaimDetails(input: ClaimDetailsInput): ClaimDetails; /** * The LAN address a node code keeps (`selectNodeClaimAddresses`' `lan`), from `claimAddresses.lan`: * `'none'` is null; an IP is itself; `'auto'` (default) is null in public-IP mode (no phone shares * a LAN with a VPS), else the gateway's `lanAddress`, else the machine's primary address * (`primaryLan`, probed only then), else undefined (keep every private address). */ export declare function claimLanAddress(settings: ClaimAddressSettings | undefined, addresses: HostedNodeAddressSource, primaryLan: () => Promise): Promise;