import { EventEmitter } from "events"; export type InterfaceName = string; export type MacAddress = string; export type IPv4Address = string; export type IPv6Address = string; export type IPAddress = IPv4Address | IPv6Address; export declare const enum IPFamily { IPv4 = "IPv4", IPv6 = "IPv6" } export interface NetworkInterface { name: InterfaceName; loopback: boolean; mac: MacAddress; ipv4?: IPv4Address; ip4Netmask?: IPv4Address; ipv4Netaddress?: IPv4Address; ipv6?: IPv6Address; ipv6Netmask?: IPv6Address; globallyRoutableIpv6?: IPv6Address; globallyRoutableIpv6Netmask?: IPv6Address; uniqueLocalIpv6?: IPv6Address; uniqueLocalIpv6Netmask?: IPv6Address; } export interface NetworkUpdate { added?: NetworkInterface[]; removed?: NetworkInterface[]; changes?: InterfaceChange[]; } export interface InterfaceChange { name: InterfaceName; outdatedIpv4?: IPv4Address; updatedIpv4?: IPv4Address; outdatedIpv6?: IPv6Address; updatedIpv6?: IPv6Address; outdatedGloballyRoutableIpv6?: IPv6Address; updatedGloballyRoutableIpv6?: IPv6Address; outdatedUniqueLocalIpv6?: IPv6Address; updatedUniqueLocalIpv6?: IPv6Address; } export interface NetworkManagerOptions { interface?: (InterfaceName | IPAddress) | (InterfaceName | IPAddress)[]; excludeIpv6?: boolean; excludeIpv6Only?: boolean; } export declare const enum NetworkManagerEvent { NETWORK_UPDATE = "network-update" } export declare interface NetworkManager { on(event: "network-update", listener: (networkUpdate: NetworkUpdate) => void): this; emit(event: "network-update", networkUpdate: NetworkUpdate): boolean; } /** * The NetworkManager maintains a representation of the network interfaces define on the host system. * It periodically checks for updated network information. * * The NetworkManager makes the following decision when checking for interfaces: * * First of all it gathers the default network interface of the system (by checking the routing table of the os) * * The following interfaces are going to be tracked: * * The loopback interface * * All interfaces which match the subnet of the default interface * * All interfaces which contain a globally unique (aka globally routable) ipv6 address */ export declare class NetworkManager extends EventEmitter { private static readonly SPACE_PATTERN; private static readonly NOTHING_FOUND_MESSAGE; private static readonly POLLING_TIME; private readonly restrictedInterfaces?; private readonly excludeIpv6; private readonly excludeIpv6Only; private currentInterfaces; private initPromise?; private currentTimer?; constructor(options?: NetworkManagerOptions); waitForInit(): Promise; shutdown(): void; getInterfaceMap(): Map; getInterface(name: InterfaceName): NetworkInterface | undefined; /** * Whether the IPv4 network address belongs to a loopback interface, read from the loopback flag of the current interfaces, so no second map can drift * from them. */ isLoopbackNetaddressV4(netaddress: IPv4Address): boolean; private scheduleNextJob; private checkForNewInterfaces; private getCurrentNetworkInterfaces; /** * The name of the interface the operating system reports an address on, for an address in the spelling a consumer gives. An IPv6 address is compared * by its canonical text against the canonical text of each IPv6 address reported, so neither spelling decides the match; an IPv4 address is compared as * given. A zone (RFC 4007 section 11) names the interface the address must be on: the interface of that name when one exists, and otherwise, for a * decimal zone, the interface whose link-local address reports that scope id. The zone 0, RFC 4007's default zone, leaves the address unconstrained as * no zone does, on whichever interface reports it first, and a zone naming no interface resolves the address to none. The zone is read here alone, so * every intake that resolves an address shares the one parse. */ static resolveInterface(address: IPAddress): InterfaceName | undefined; private static zoneInterfaces; private static getNetworkInterfaceNames; private static assumeNetworkInterfaceNames; private static getLoopbackInterface; private static getWindowsNetworkInterfaces; private static getDarwinNetworkInterfaces; private static getLinuxNetworkInterfaces; private static getFreeBSDNetworkInterfaces; private static getOpenBSD_SUNOS_NetworkInterfaces; } //# sourceMappingURL=NetworkManager.d.ts.map