/** * The TLS ClientHello, read for one thing: the name the client is connecting * to, which the server_name extension carries in the clear. A transparent * interceptor has no other way to learn where a redirected TLS connection was * going, so this parser decides where bytes are sent; it is therefore small, * linear, and bounded, and it refuses anything it cannot place rather than * guess. It never reads past the handshake, never keeps a byte, and reports * the negotiated protocols (ALPN) beside the name because a later phase * decides from them what it can terminate. * * RFC 8446 section 4.1.2 (ClientHello), RFC 6066 section 3 (server_name), * RFC 7301 (ALPN). */ /** The reading of a client's first bytes as TLS. */ export type ClientHelloReading = /** The bytes are a TLS handshake but the ClientHello is not complete yet. */ { readonly kind: "NEED_MORE"; } /** The bytes are not a TLS handshake record at all. */ | { readonly kind: "NOT_TLS"; } /** A ClientHello whose fields could not be read as the RFC lays them out. */ | { readonly kind: "MALFORMED"; } | { readonly kind: "CLIENT_HELLO"; /** The server_name host, lowercase; null when the client sent none. */ readonly serverName: string | null; readonly alpn: readonly string[]; }; /** The most handshake bytes read before a hello is called malformed; well beyond any real one. */ export declare const MAX_CLIENT_HELLO_BYTES = 65536; /** Reads a client's first bytes as a TLS ClientHello, or says why they are not one. */ export declare function readClientHello(bytes: Uint8Array): ClientHelloReading; //# sourceMappingURL=ClientHello.d.ts.map