import type { Result } from "@cprussin/option-result"; import type { Files } from "@domicile-desktop/sdk/desktop/files"; import type { Processes } from "@domicile-desktop/sdk/desktop/processes"; import type { SystemError } from "@domicile-desktop/sdk/system"; export declare enum InterfaceKind { Wired = 0, Wireless = 1 } /** A network interface with hardware behind it. */ export type NetworkInterface = { name: string; kind: InterfaceKind; hardwareAddress: string; /** Whether it has a link: a cable in, or a Wi-Fi network joined. */ up: boolean; /** A wired link's speed in Mbit/s, when the driver knows it. */ speed: number | undefined; }; /** * An interface's lasting global addresses with their prefix length, e.g. * `192.168.1.40/24`, from `ip`. Temporary IPv6 addresses are left out: they * rotate daily and nothing reaches the machine at them. */ export type Addressing = { ipv4: string[]; ipv6: string[]; /** The default route's gateway through it. */ gateway: string | undefined; }; /** The calls {@link readInterfaces} makes. Each works while the desktop is locked. */ export type InterfaceDesktop = { readonly files: Pick; }; /** * The interfaces with hardware behind them, by name. Virtual ones, such as * the loopback, a bridge or a VPN, have no `device` link and are left out. */ export declare const readInterfaces: (domicile: InterfaceDesktop) => Promise>; /** * Calls `onInterfaces` with {@link readInterfaces} now and whenever it * changes, and returns a function that stops watching. Reads every 5 seconds. */ export declare const watchInterfaces: (domicile: InterfaceDesktop, onInterfaces: (interfaces: Result) => void, every?: typeof everyInterval) => (() => void); /** * Calls `onAddresses` with {@link readAddresses} now and whenever it changes, * and returns a function that stops watching. Reads every 5 seconds. */ export declare const watchAddresses: (domicile: { readonly processes: Pick; }, onAddresses: (addresses: Result, SystemError>) => void, every?: typeof everyInterval) => (() => void); /** * Each interface's lasting global addresses and default gateway, by name, from * `ip -j`. `ip` must be on the compositor's `PATH`. */ export declare const readAddresses: (domicile: { readonly processes: Pick; }) => Promise, SystemError>>; declare const everyInterval: (ms: number, tick: () => void) => (() => void); export {};