import { ClusterNode } from './request'; import EventsScope from '../common/events/events-scope'; import { Enum } from '../constants'; import { ClusterReachabilityResult, NatType } from './reachability.types'; export type ResultEventData = { protocol: 'udp' | 'tcp' | 'xtls'; result: 'reachable' | 'unreachable' | 'untested'; latencyInMilliseconds: number; clientMediaIPs?: string[]; }; export type ClientMediaIpsUpdatedEventData = { protocol: 'udp' | 'tcp' | 'xtls'; clientMediaIPs: string[]; }; export type NatTypeUpdatedEventData = { natType: NatType; }; export declare const Events: { readonly resultReady: "resultReady"; readonly clientMediaIpsUpdated: "clientMediaIpsUpdated"; readonly natTypeUpdated: "natTypeUpdated"; }; export type Events = Enum; /** * A class that handles reachability checks for a single cluster. * Creates and orchestrates ReachabilityPeerConnection instance(s). * Listens to events and emits them to consumers. * * When enablePerUdpUrlReachability is true: * - Creates one ReachabilityPeerConnection for each UDP URL * - Creates one ReachabilityPeerConnection for all TCP and TLS URLs together * Otherwise: * - Creates a single ReachabilityPeerConnection for all URLs */ export declare class ClusterReachability extends EventsScope { private reachabilityPeerConnection; private reachabilityPeerConnectionsForUdp; readonly isVideoMesh: boolean; readonly name: any; readonly reachedSubnets: Set; private enablePerUdpUrlReachability; private udpResultEmitted; /** * Constructor for ClusterReachability * @param {string} name cluster name * @param {ClusterNode} clusterInfo information about the media cluster * @param {boolean} enablePerUdpUrlReachability whether to create separate peer connections per UDP URL */ constructor(name: string, clusterInfo: ClusterNode, enablePerUdpUrlReachability?: boolean); /** * Initializes a single ReachabilityPeerConnection for all protocols * @param {ClusterNode} clusterInfo information about the media cluster * @returns {void} */ private initializeSingleReachabilityPeerConnection; /** * Initializes per-URL UDP reachability checks: * - One ReachabilityPeerConnection per UDP URL * - One ReachabilityPeerConnection for all TCP and TLS URLs together * @param {ClusterNode} clusterInfo information about the media cluster * @returns {void} */ private initializePerUdpUrlReachabilityCheck; /** * Sets up event listeners for a ReachabilityPeerConnection instance * @param {ReachabilityPeerConnection} rpc the ReachabilityPeerConnection instance * @param {boolean} isUdpPerUrl whether this is a per-URL UDP instance * @returns {void} */ private setupReachabilityPeerConnectionEventListeners; /** * Gets the aggregated reachability result for this cluster. * @returns {ClusterReachabilityResult} reachability result for this cluster */ getResult(): ClusterReachabilityResult; /** * Starts the process of doing UDP, TCP, and XTLS reachability checks on the media cluster. * @returns {Promise} */ start(): Promise; /** * Aborts the cluster reachability checks * @returns {void} */ abort(): void; }