availability

js/net/quic/availability.ts

Constants

const cryptoBackend

Identifier of the active TLS crypto backend, or null when QUIC is unavailable.

Reports which ngtcp2 crypto helper is in use (for example the OpenSSL or GnuTLS backend), useful for diagnostics and backend-specific test skips.

const quicAvailable

Whether this build can run QUIC at all.

True only when both an ngtcp2 library and a working TLS crypto backend were found. Guard endpoint construction with this (or call requireQuic(), which throws) before using anything else in the module.

import { quicAvailable, QuicEndpoint } from 'internal:net/quic/endpoint';
if (!quicAvailable) throw new Error('QUIC unavailable in this build');
const endpoint = new QuicEndpoint();

const quicResetStreamAtAvailable

Whether the loaded ngtcp2 supports the reliable stream reset extension.

When false, QuicStream.resetAt() throws because the native ngtcp2_conn_reset_stream_at symbol is missing. reset() is always available.

const quicVersion: string | null

Human-readable version string of the loaded ngtcp2 library, or null when QUIC is unavailable.

Resolves from ngtcp2_version() at module load; falls back to the bare string 'ngtcp2' when the library reports no readable version.

Functions

function requireQuic(): void

Assert that QUIC is usable, throwing a descriptive error otherwise.

Verifies both the ngtcp2 library and the TLS crypto backend are present. listen() and connect() call this internally, so most callers rely on the check indirectly; use it directly to fail fast before doing setup work.

Throws when ngtcp2 or the crypto backend is missing from the build.

import { requireQuic } from 'internal:net/quic/endpoint';
requireQuic(); // throws here if QUIC is unavailable