MsetSNIContexts
Bun

method

quic.QuicEndpoint.setSNIContexts

entries: Record<string, SNIEntry>,
): void;

Replaces or updates the SNI TLS contexts for this endpoint. This allows changing the TLS identity (key/certificate) used for specific host names without restarting the endpoint. Existing sessions are unaffected — only new sessions will use the updated contexts.

endpoint.setSNIContexts({
  'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
});

// Replace the entire SNI map
endpoint.setSNIContexts({
  'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
}, { replace: true });
@param entries

An object mapping host names to TLS identity options. Each entry must include keys and certs.

Referenced types

interface SNIEntry

interface SetSNIContextsOptions