import { type AgoraRteError } from '../utilities/error'; type HostConfig = { hostname: string[]; port: number; }; export interface AgoraRtcAccessPointConfig { /** ap 服务器地址列表 */ serverList: string[]; } export interface AgoraWebRtcAccessPointConfig extends AgoraRtcAccessPointConfig { serverDomain: string; serverPort: number; reportConfig?: HostConfig; logConfig?: HostConfig; cdsConfig?: HostConfig; } export interface AgoraElectronRtcAccessPointConfig extends AgoraRtcAccessPointConfig { verifyDomainName: string; } export interface AgoraRteApDetectorObserver { onDetectionSuccess?(): void; onDetectionFailure?(): void; onRedetectionSuccess?(): void; onRedetectionFailure?(): void; } export interface AgoraRteApDetector { /** * 判断是否需要进行探测 */ isDetectRequired(): boolean; /** * 开始探测可用IP */ start(success?: () => void, failure?: (agoraRteError: AgoraRteError) => void): Promise; /** * 停止探测可用IP */ stop(): void; /** * 是否已探测完成 */ isFinished(): boolean; /** * 是否在探测中 */ isDetecting(): boolean; /** * 获取可用IP列表 */ getAvailableRtcAccessPointConfig(): AgoraRtcAccessPointConfig | null; /** * 设置探测配置 * @param detectTimeout 探测超时时间,单位ms, 如果传入 0 或者负数,则使用默认值300ms * @param isRedetect 是否在 rtc channel client 断线重连时,重新进行探测, 默认值 true */ setConfig(internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig, detectTimeout?: number, isRedetect?: boolean): void; /** * 重新探测可用IP */ restart(success?: () => void, failure?: (agoraRteError: AgoraRteError) => void): Promise; addObserver(observer: AgoraRteApDetectorObserver): void; removeObserver(observer: AgoraRteApDetectorObserver): void; } export declare const isIP: (ip: string) => boolean; export declare const isDomainName: (str: string) => boolean; export declare const transformUrlToRequestUrl: (url: string, isElectron: boolean, port?: number) => string; export declare class AgoraRteApDetectorImpl implements AgoraRteApDetector { protected logger: import("agora-foundation/lib/logger/type").Logger; private readonly _isElectron; /** 最小的探测数 */ private readonly _minCount; private _detectTimeout; private _isRedetect; private _isFinished; private _isDetecting; private _abortController; private _internalRtcConfig?; private _externalRtcConfig?; private _availableRtcAccessPointConfig; private _apDetectorObserver; /** * @constructor * @param internalRtcConfig 内网探测配置 * @param externalRtcConfig 外网探测配置 * @param detectTimeout 探测超时时间,单位ms, 如果传入 0 或者负数,则使用默认值300ms * @param isRedetect 是否在 rtc channel client 断线重连时,重新进行探测, 默认值 true */ constructor(internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig, detectTimeout?: number, isRedetect?: boolean); addObserver(observer: AgoraRteApDetectorObserver): void; removeObserver(observer: AgoraRteApDetectorObserver): void; isFinished(): boolean; isDetecting(): boolean; getAvailableRtcAccessPointConfig(): AgoraRtcAccessPointConfig | null; isDetectRequired(): boolean; setConfig(internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig, detectTimeout?: number, isRedetect?: boolean): void; stop(): void; restart(success?: () => void, failure?: (agoraRteError: AgoraRteError) => void): Promise; start(success?: () => void, failure?: (agoraRteError: AgoraRteError) => void): Promise; private _setConfigIsValid; private _executeDetect; private _getServerPort; private _runAllDetectTask; private _runBatchDetectTask; private _runOnceDetectTask; private _fetchWithTimeoutAndCheck; private _resolveParamsRtcConfig; private _resolveParamsDetecTimeout; private _resolveParamsIsRedetect; } export {};