import type pino from "pino";
import { type KeyPair } from "@kong-link/relay/e2ee";
import type { ExternalSocketMetadata } from "./websocket-server.js";
interface RelayTransportOptions {
    logger: pino.Logger;
    attachSocket: (ws: RelaySocketLike, metadata?: ExternalSocketMetadata) => Promise<void>;
    relayEndpoint: string;
    relayUseTls: boolean;
    serverId: string;
    daemonKeyPair?: KeyPair;
    createWebSocket?: RelayWebSocketFactory;
}
export interface RelayTransportController {
    stop: () => Promise<void>;
}
interface RelaySocketLike {
    readyState: number;
    send: (data: string | Uint8Array | ArrayBuffer) => void;
    close: (code?: number, reason?: string) => void;
    on: (event: "message" | "close" | "error", listener: (...args: unknown[]) => void) => void;
    once: (event: "close" | "error", listener: (...args: unknown[]) => void) => void;
}
interface RelayWebSocketLike extends RelaySocketLike {
    terminate: () => void;
    ping: () => void;
    on: (event: "open" | "message" | "close" | "error" | "pong", listener: (...args: unknown[]) => void) => void;
}
type RelayWebSocketFactory = (url: string) => RelayWebSocketLike;
export declare function startRelayTransport({ logger, attachSocket, relayEndpoint, relayUseTls, serverId, daemonKeyPair, createWebSocket, }: RelayTransportOptions): RelayTransportController;
export {};
//# sourceMappingURL=relay-transport.d.ts.map