/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Diagnostic } from "#log/Diagnostic.js"; import { Duration } from "#time/Duration.js"; import { Timestamp } from "#time/Timestamp.js"; export interface AddressLifespan { /** * Beginning of lifespan */ discoveredAt: Timestamp; /** * Length of lifespan, if known */ ttl: Duration; } export interface AddressStatus extends Partial { /** * Time of last successful access. */ healthyAt?: Timestamp; /** * Time of last unsuccessful access. */ unhealthyAt?: Timestamp; /** * DNS priority. */ priority?: number; /** * DNS weight. */ weight?: number; } export type ServerAddressUdp = { type: "udp"; ip: string; port: number; } & AddressStatus; export type ServerAddressTcp = { type: "tcp"; ip: string; port: number; } & AddressStatus; export type ServerAddressBle = { type: "ble"; peripheralAddress: string; } & AddressStatus; export type ServerAddress = ServerAddressUdp | ServerAddressTcp | ServerAddressBle; export declare function ServerAddress(definition: ServerAddress): ServerAddress; export declare namespace ServerAddress { function urlFor(address: ServerAddress): string; function diagnosticFor(address: ServerAddress): Diagnostic; function isEqual(a: ServerAddress, b: ServerAddress): boolean; /** * Compute logical health of an address. * * This returns heathyAt/unhealthyAt values with unhealthyAt set to undefined if the address was more recently * healthy. */ function healthOf(health: AddressStatus): AddressStatus; /** * Network address desirability from a Matter communication perspective. * * Lower values indicate higher preference. This is not a standard "happy eyeballs" ranking but works similarly. */ enum SelectionPreference { IPV6_ULA = 0, IPV6_LINK_LOCAL = 1, IPV6 = 2, IPV4 = 3, NOT_IP = 3 } function selectionPreferenceOf(address: ServerAddress): SelectionPreference; } //# sourceMappingURL=ServerAddress.d.ts.map