import { Transport } from './transport'; import * as protobuf from "./aws-iot-tunnel/protobuf-messages"; export type TunnelMessage = protobuf.com.amazonaws.iot.securedtunneling.IProtocolV1Message | protobuf.com.amazonaws.iot.securedtunneling.IProtocolV2Message | protobuf.com.amazonaws.iot.securedtunneling.IProtocolV3Message; export declare const TunnelMessageType: { readonly UNKNOWN: 0; readonly DATA: 1; readonly STREAM_START: 2; readonly STREAM_RESET: 3; readonly SESSION_RESET: 4; readonly SERVICE_IDS: 5; readonly CONNECTION_START: 6; readonly CONNECTION_RESET: 7; }; export type TunnelMessageTypeEnum = (typeof TunnelMessageType)[keyof typeof TunnelMessageType]; export interface SecureTunnelConfig { region: string; accessToken: string; clientMode: "source" | "destination"; serviceId?: string; protocol?: "V1" | "V2" | "V3"; } /** * AWS IoT Secure Tunnel Transport implementation * Handles the WebSocket connection to AWS IoT Secure Tunneling service * and manages the protocol-specific message framing */ export declare class SecureTunnelTransport implements Transport { private ws; private config; private streamId; private connectionId; private isConnected; private tunnelReady; private messageQueue; private receiveBuffer; private messageClass; id: string; onData?: (data: Uint8Array) => void; onError?: (error: Error) => void; onClose?: () => void; constructor(id: string, config: SecureTunnelConfig); /** * Connect to AWS IoT Secure Tunnel WebSocket endpoint */ connect(): Promise; /** * Disconnect from the tunnel */ disconnect(): Promise; /** * Send data through the tunnel */ send(data: Uint8Array): Promise; /** * Process queued messages once tunnel is ready */ private processQueuedMessages; /** * Build the WebSocket URL for AWS IoT Secure Tunneling */ private buildWebSocketUrl; /** * Send a control message through the tunnel */ private sendControlMessage; /** * Send a data frame through the tunnel */ private sendDataFrame; /** * Send a frame with length prefix */ private sendFrame; /** * Handle incoming WebSocket data */ private handleIncomingData; /** * Handle a decoded tunnel message */ private handleMessage; /** * Encode a message using protobufjs */ private encodeMessage; /** * Decode a message using protobufjs */ private decodeMessage; /** * Get message type name for logging */ private getMessageTypeName; } //# sourceMappingURL=aws-iot-tunnel.d.ts.map