import { EventEmitter } from 'node:events';
import type { TunnelQrPayload, TunnelStatus } from './tunnel-types.js';
export type TunnelServiceConfig = {
    brokerUrl: string;
    registrationSecret: string;
    autoStart: boolean;
    gatewayHost: string;
    frpSubdomainHost: string;
};
export declare function hashGatewayToken(token: string): string;
export declare function getTunnelService(): TunnelService;
export declare class TunnelService extends EventEmitter {
    private serviceConfig;
    private frpcHandle;
    private heartbeatTimer;
    private connectedSince;
    private lastHeartbeatAt;
    private lastError;
    private state;
    private reconnectAttempt;
    private stopping;
    private startContext;
    private frpcDownload;
    private startProgress;
    configure(cfg: TunnelServiceConfig): void;
    getStatus(): TunnelStatus;
    private setStartPhase;
    private clearStartProgress;
    buildQr(gatewayPort: number, gatewayHost: string): Promise<TunnelQrPayload>;
    start(gatewayPort: number, gatewayToken: string): Promise<TunnelQrPayload>;
    stop(opts?: {
        release?: boolean;
    }): Promise<{
        released: boolean;
    }>;
    private resolveRegistration;
    private spawnAndWait;
    private scheduleReconnect;
    private startHeartbeat;
    private clearHeartbeat;
}
