{
  "type": "module",
  "source": "doc/api/dtls.md",
  "modules": [
    {
      "textRaw": "DTLS",
      "name": "dtls",
      "introduced_in": "v26.9.0",
      "type": "module",
      "meta": {
        "added": [
          "v26.9.0"
        ],
        "changes": []
      },
      "stability": 1.1,
      "stabilityText": "Active Development",
      "desc": "<p>The <code>node:dtls</code> module provides an implementation of the Datagram Transport\nLayer Security (DTLS) protocol over UDP. DTLS provides TLS-equivalent\nsecurity guarantees for datagram-based communication, including\nconfidentiality, integrity, and authentication.</p>\n<p>To use this module, it must be enabled at build time with the\n<code>--experimental-dtls</code> configure flag and at runtime with the\n<code>--experimental-dtls</code> CLI flag.</p>\n<pre><code class=\"language-bash\">node --experimental-dtls app.mjs\n</code></pre>\n<pre><code class=\"language-mjs\">import { listen, connect } from 'node:dtls';\n</code></pre>\n<pre><code class=\"language-cjs\">const { listen, connect } = require('node:dtls');\n</code></pre>",
      "modules": [
        {
          "textRaw": "Permission model",
          "name": "permission_model",
          "type": "module",
          "desc": "<p>When using the <a href=\"permissions.html#permission-model\">Permission Model</a>, the <code>--allow-net</code> flag must be passed to\nallow DTLS network operations. Without it, calling <a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a> or\n<a href=\"#dtlslistencallback-options\"><code>dtls.listen()</code></a> will throw an <code>ERR_ACCESS_DENIED</code> error.</p>\n<pre><code class=\"language-console\">node --permission --allow-fs-read=* --experimental-dtls index.mjs\nError: Access to this API has been restricted. Use --allow-net to manage permissions.\n  code: 'ERR_ACCESS_DENIED',\n  permission: 'Net',\n}\n</code></pre>\n<p>Creating a <a href=\"#class-dtlsendpoint\"><code>DTLSEndpoint</code></a> instance without connecting or listening\nis permitted even without <code>--allow-net</code>, since no network I/O occurs until\n<a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a> or <a href=\"#dtlslistencallback-options\"><code>dtls.listen()</code></a> is called.</p>",
          "displayName": "Permission model"
        },
        {
          "textRaw": "DTLS vs TLS",
          "name": "dtls_vs_tls",
          "type": "module",
          "desc": "<p>DTLS is designed for UDP transport and differs from TLS in several key ways:</p>\n<ul>\n<li>No stream guarantees: Messages may arrive out of order or be lost.\nDTLS preserves datagram semantics.</li>\n<li>One socket, many peers: A single UDP socket can serve multiple DTLS\nsessions. The <code>DTLSEndpoint</code> manages this multiplexing.</li>\n<li>Cookie exchange: DTLS servers use a stateless cookie mechanism\n(HelloVerifyRequest) to prevent denial-of-service amplification attacks.</li>\n<li>Retransmission: DTLS handles handshake retransmission internally since\nUDP does not guarantee delivery.</li>\n</ul>",
          "displayName": "DTLS vs TLS"
        },
        {
          "textRaw": "Server Name Indication",
          "name": "server_name_indication",
          "type": "module",
          "desc": "<p>An endpoint can serve more than one identity by giving <code>listen()</code> an <code>sni</code>\nmap, or a function. Each key of a map is a host name and each value is either\na\n<a href=\"#class-dtlssecurecontext\"><code>DTLSSecureContext</code></a> created with <code>isServer: true</code>, or a plain object of\nthe same options <a href=\"#dtlscreatesecurecontextoptions\"><code>dtls.createSecureContext()</code></a> takes:</p>\n<pre><code class=\"language-mjs\">import { createSecureContext, listen } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst endpoint = listen(onsession, {\n  cert: readFileSync('default-cert.pem'),\n  key: readFileSync('default-key.pem'),\n  port: 5684,\n  sni: {\n    'api.example.com': {\n      cert: readFileSync('api-cert.pem'),\n      key: readFileSync('api-key.pem'),\n    },\n    'www.example.com': createSecureContext({\n      cert: readFileSync('www-cert.pem'),\n      key: readFileSync('www-key.pem'),\n      isServer: true,\n    }),\n    '*': {\n      cert: readFileSync('default-cert.pem'),\n      key: readFileSync('default-key.pem'),\n    },\n  },\n});\n</code></pre>\n<p>The <code>'*'</code> key is the fallback, used when the client's name matches nothing and\nwhen the client sends no name at all. <strong>Without it, an unmatched name is\nrefused with an <code>unrecognized_name</code> alert</strong> rather than falling back to the\nendpoint's own <code>cert</code> and <code>key</code>; providing an <code>sni</code> map is taken to mean that\nonly the names in it are served. <a href=\"tls.html#tlscreateserveroptions-secureconnectionlistener\"><code>tls.createServer()</code></a> differs here: its\n<code>SNICallback</code> falls back to the default identity silently.</p>\n<p>Verification follows the selected identity, so an entry carrying its own <code>ca</code>\naccepts only client certificates issued under it. <code>requestCert</code> and\n<code>rejectUnauthorized</code> are not per-identity: they belong to the endpoint and\napply to every name it serves.</p>\n<p>A function may be given instead of a map, for identities that are chosen\nrather than enumerated:</p>\n<pre><code class=\"language-mjs\">listen(onsession, {\n  port: 5684,\n  cert,\n  key,\n  sni: (servername) => contexts.get(servername),\n});\n</code></pre>\n<p>It is called with the name the client asked for, or <code>undefined</code> if the client\nsent no SNI extension, and returns what a map entry holds: a\n<a href=\"#dtlscreatesecurecontextoptions\"><code>dtls.createSecureContext()</code></a> result or the options to build one. Returning\nnothing declines the name, which is refused exactly as an unmatched map with no\n<code>'*'</code> entry is, rather than falling back to the endpoint's own certificate.</p>\n<p>The function runs during the handshake and must return synchronously, so it\ncannot consult a database. Returning a prepared context is worth doing:\nbuilding one from options parses the certificate again on every handshake.</p>\n<p>An exception thrown by the function fails that handshake and is reported to the\nsession's error handler, like any other handshake failure. It does not reach\nthe process as an uncaught exception.</p>\n<p>The certificate and the cipher list both follow the selected context.\nPre-shared keys do not. OpenSSL installs the PSK callbacks on the connection\nwhen it is created, before any name is known, and selecting an identity does\nnot replace them, so the keys a server accepts are always the endpoint's own.\nA <code>psk</code> given on an SNI identity is never consulted, and an identity cannot be\nserved over PSK alone.</p>\n<p><code>sni</code> belongs to the secure context rather than to the endpoint, so it can be\ngiven to <a href=\"#dtlscreatesecurecontextoptions\"><code>dtls.createSecureContext()</code></a> and cannot be combined with a\n<code>secureContext</code> that already exists. Applying it to a prepared context would\nreconfigure that context for every endpoint sharing it, and the identities a\nserver serves are part of what its context is.</p>\n<p>A connection refused for an unrecognized name still reaches the <code>listen()</code>\ncallback: the session exists once the client's address is validated, which\nhappens before the name is examined. It then fails like any other handshake\nfailure.</p>",
          "displayName": "Server Name Indication"
        },
        {
          "textRaw": "Denial of service",
          "name": "denial_of_service",
          "type": "module",
          "desc": "<p>Cookie exchange proves a peer can receive at its claimed address, but it does\nnot limit how many sessions that peer may then establish, and each session\nholds a TLS state machine, two buffers and a timer. <code>maxSessions</code> bounds the\ntotal; <code>maxSessionsPerHost</code> is what prevents one peer from taking all of it.\nA peer refused by either cap is answered with silence rather than an alert,\nbecause replying to an address that has not completed cookie exchange would\ncreate an amplification vector; a legitimate client retransmits and is\nadmitted once there is room. Refusals are counted by\n<a href=\"#endpointstatsserverrefusedcount\"><code>endpointStats.serverRefusedCount</code></a>.</p>\n<p>Deployments serving many clients behind a single NAT may need to raise\n<code>maxSessionsPerHost</code>.</p>",
          "displayName": "Denial of service"
        },
        {
          "textRaw": "Handshake timeout",
          "name": "handshake_timeout",
          "type": "module",
          "desc": "<p>A handshake that never finishes is abandoned after <code>handshakeTimeout</code>\nmilliseconds, and its session error is <code>DTLS handshake timeout</code>.</p>\n<p>OpenSSL already gives up on its own, but only after twelve retransmits on a\ndoubling backoff capped at 60 seconds -- around eight minutes in total. Until\nthen the session holds its place against <code>maxSessions</code> (see\n<a href=\"#denial-of-service\">Denial of service</a>),\nso handshakes that are started and abandoned can occupy an endpoint for the\ncost of starting them. That needs no spoofing: the peer completes the cookie\nexchange and then simply stops.</p>\n<p>The two limits coexist and whichever comes first ends the handshake. The\nretransmit schedule itself is untouched, deliberately -- compressing it to\nforce earlier failure would cause spurious retransmissions on exactly the\nlossy links DTLS is meant for.</p>\n<p>The timeout covers resumed and PSK handshakes as well, and stops applying once\nthe handshake completes; it is not an idle timeout.</p>\n<p>A handshake can stall without either peer being at fault or aware.\nDTLS discards records it cannot authenticate rather than answering them\n(RFC 6347 section 4.1.2.1), so a mismatched pre-shared key or a cipher list\nwith nothing in common produces silence rather than an alert. This timeout is\nwhat ends those.</p>",
          "displayName": "Handshake timeout"
        },
        {
          "textRaw": "Pre-shared keys",
          "name": "pre-shared_keys",
          "type": "module",
          "desc": "<p>DTLS can authenticate with a key both peers already hold instead of a\ncertificate (RFC 4279). This is how it is usually deployed to constrained\ndevices, which frequently have no certificate at all.</p>\n<p>A server gives the identities it accepts; a client gives the one it is. No\ncertificate is needed on either side:</p>\n<pre><code class=\"language-mjs\">import { connect, listen } from 'node:dtls';\n\nconst endpoint = listen(onsession, {\n  port: 5684,\n  psk: { 'device-42': deviceKey },\n});\n\nconst client = connect('192.0.2.1', 5684, {\n  psk: { identity: 'device-42', key: deviceKey },\n});\n</code></pre>\n<p>Either side may pass a function instead, for keys that are looked up or\nderived rather than known up front. A server's is called with the identity the\nclient offered and returns the key, or nothing to refuse it. A client's is\ncalled with the server's identity hint, if it sent one, and returns\n<code>{ identity, key }</code>:</p>\n<pre><code class=\"language-mjs\">listen(onsession, {\n  port: 5684,\n  psk: (identity) => deriveKey(masterSecret, identity),\n});\n</code></pre>\n<p>The callback runs during the handshake and must return synchronously, so it\ncannot consult a database. Where both are given, the map is checked first and\nthe callback is only reached when the map has no answer -- a configuration\nusing only the map never runs JavaScript inside the handshake.</p>\n<p>An exception thrown by the callback fails that handshake and is reported to\nthe session's error handler. It does not reach the process as an uncaught\nexception.</p>",
          "modules": [
            {
              "textRaw": "Cipher suites",
              "name": "cipher_suites",
              "type": "module",
              "desc": "<p>The default cipher list excludes PSK, so giving <code>psk</code> without <code>ciphers</code>\nenables the PSK suites. Supplying <code>ciphers</code> disables that and uses exactly\nwhat was asked for.</p>\n<p>A server keeps the certificate suites as well, since it may serve both kinds\nof client on one port. A client does not: a client that configured a\npre-shared key and no CA wants the key, and leaving the certificate suites\nenabled would let a server choose one, failing the handshake while verifying a\ncertificate the caller never meant to rely on.</p>\n<p>Forward-secret PSK key exchanges are preferred over plain PSK of the same\nstrength. Plain PSK derives its keys from the shared secret alone, so anyone\nwho later learns that key can decrypt traffic they recorded earlier. <code>RSA-PSK</code>\nis excluded: it needs a certificate and adds no forward secrecy.</p>\n<p>CoAP requires <code>TLS_PSK_WITH_AES_128_CCM_8</code> (RFC 7252), whose 64-bit\nauthentication tag OpenSSL rejects at security level 1 and above. Node.js\ndefault is above it, so that suite has to be asked for explicitly and with the\nsecurity level lowered:</p>\n<pre><code class=\"language-mjs\">listen(onsession, { port: 5684, psk, ciphers: 'PSK-AES128-CCM8@SECLEVEL=0' });\n</code></pre>",
              "displayName": "Cipher suites"
            },
            {
              "textRaw": "Failure modes",
              "name": "failure_modes",
              "type": "module",
              "desc": "<p>A wrong key does not produce an error. The identity only names the key, so the\nhandshake proceeds and the two sides derive different secrets; the first\nrecord that fails authentication is then discarded rather than answered, since\nDTLS discards invalid records instead of replying to them (RFC 6347 section\n4.1.2.1). Neither peer is told anything and both retransmit.</p>\n<p>A cipher list with nothing in common behaves the same way, which is what makes\nthe <code>CCM8</code> case above present as a stall rather than a rejection. Both are\nended by <a href=\"#handshake-timeout\"><code>handshakeTimeout</code></a>, after 60 seconds by default.</p>\n<p>An identity the server does not recognise is refused outright, and the client\nsees the handshake fail.</p>",
              "displayName": "Failure modes"
            }
          ],
          "displayName": "Pre-shared keys"
        },
        {
          "textRaw": "Session resumption",
          "name": "session_resumption",
          "type": "module",
          "desc": "<p>A resumed handshake skips the server's certificate, which matters more here\nthan it does over TCP: the <code>Certificate</code> flight is fragmented across several\ndatagrams, and losing any one of them costs a retransmission timeout. Measured\non loopback, a full handshake has the server send 1850 bytes in 4 packets\nagainst 280 bytes in 3 for a resumed one.</p>\n<p>A client reads <a href=\"#sessionsession\"><code>session.session</code></a> once the session is open and passes it to\na later <a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a>:</p>\n<pre><code class=\"language-mjs\">import { connect } from 'node:dtls';\n\nconst first = connect('192.0.2.1', 5684, { ca, servername: 'device.example' });\nawait first.opened;\nconst ticket = first.session;        // Buffer.\nawait first.close();\n\nconst second = connect('192.0.2.1', 5684, {\n  ca,\n  servername: 'device.example',\n  session: ticket,\n});\nawait second.opened;\nconsole.log(second.reused);          // True.\n</code></pre>\n<p>A session that the server will not accept -- expired, or issued by a different\nendpoint -- is not an error. The handshake simply proceeds in full, and\n<a href=\"#sessionreused\"><code>session.reused</code></a> is <code>false</code>.</p>\n<p>The cookie exchange still happens for a resumed handshake, so resumption is not\na way around the address validation described under <a href=\"#denial-of-service\">Denial of service</a>.</p>",
          "modules": [
            {
              "textRaw": "Binding to the authenticated host",
              "name": "binding_to_the_authenticated_host",
              "type": "module",
              "desc": "<p>A session may only be resumed against the identity it was authenticated for --\nthe <code>servername</code>, or the host when there is none. Reusing it for anything else\nthrows.</p>\n<p>This is not a convenience check. A resumed handshake does not re-send or\nre-verify the peer's certificate; it inherits the authenticated identity of the\noriginal session. Replaying a session against a different host would therefore\nskip verification while appearing to succeed. For the same reason a <code>session</code>\nthat did not come from <a href=\"#sessionsession\"><code>session.session</code></a> is rejected outright: nothing\nrecords which identity it belongs to, so it cannot be checked.</p>",
              "displayName": "Binding to the authenticated host"
            },
            {
              "textRaw": "Resuming under `rejectUnauthorized`",
              "name": "resuming_under_`rejectunauthorized`",
              "type": "module",
              "desc": "<p>A session carries the verification result it was established with, so a session\nestablished with <code>rejectUnauthorized: false</code> cannot be resumed by a connection\nthat asked for a verified peer. The handshake fails:</p>\n<pre><code class=\"language-mjs\">import { connect } from 'node:dtls';\n\n// Connected without verifying anything.\nconst first = connect('192.0.2.1', 5684, { rejectUnauthorized: false });\nawait first.opened;\nconsole.log(first.authorized);         // False.\nconst ticket = first.session;\nawait first.close();\n\nconst second = connect('192.0.2.1', 5684, {\n  rejectUnauthorized: true,\n  session: ticket,\n});\nawait second.opened;                   // Rejects: verification failed.\n</code></pre>\n<p>The host is the same in both, so binding the session to its authenticated\nidentity does not cover this on its own; what differs is whether the caller\nasked for the peer to be verified. Because a resumed handshake runs no\nverification of its own, the recorded result is re-checked once it completes,\nand a session whose peer never verified is refused wherever verification is\nrequired. <a href=\"#sessionauthorized\"><code>session.authorized</code></a> and <a href=\"#sessionauthorizationerror\"><code>session.authorizationError</code></a> report\nthe recorded result on a resumed session either way.</p>",
              "displayName": "Resuming under `rejectUnauthorized`"
            },
            {
              "textRaw": "Ticket keys",
              "name": "ticket_keys",
              "type": "module",
              "desc": "<p>The key that encrypts session tickets is generated at random for each context,\nso by default a ticket is only good for the endpoint that issued it and only\nuntil the process restarts. Give every endpoint the same <code>ticketKeys</code> to let\ntickets be resumed across a restart or a cluster:</p>\n<pre><code class=\"language-mjs\">import { listen } from 'node:dtls';\nimport { randomBytes } from 'node:crypto';\n\nconst ticketKeys = randomBytes(80);    // Share this between processes.\nconst endpoint = listen(onsession, { cert, key, port: 5684, ticketKeys });\n</code></pre>\n<p>The length is OpenSSL's: a key name followed by an HMAC key and an AES key. It\ndiffers from the 48 bytes <a href=\"tls.html#tlscreateserveroptions-secureconnectionlistener\"><code>tls.createServer()</code></a> uses, which is a layout\n<code>node:tls</code> defines for itself. Supplying the wrong length throws and reports\nthe length expected.</p>\n<p>Ticket keys are long-lived secrets. Anyone holding them can decrypt tickets and\nrecover the sessions they protect, so treat them as key material and rotate\nthem.</p>",
              "displayName": "Ticket keys"
            }
          ],
          "displayName": "Session resumption"
        },
        {
          "textRaw": "DTLS-SRTP example",
          "name": "dtls-srtp_example",
          "type": "module",
          "desc": "<p>DTLS-SRTP is used by WebRTC for media encryption. The DTLS handshake\nnegotiates the SRTP protection profile and provides keying material.</p>\n<pre><code class=\"language-mjs\">import { listen, connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\n// Server with SRTP\nconst server = listen((session) => {\n  session.onhandshake = () => {\n    console.log('SRTP profile:', session.srtpProfile);\n    const keys = session.exportKeyingMaterial(\n      60,\n      'EXTRACTOR-dtls_srtp',\n    );\n    console.log('SRTP keying material:', keys);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 5004,\n  srtp: 'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM',\n});\n\n// Client with SRTP\nconst session = connect('127.0.0.1', 5004, {\n  rejectUnauthorized: false,\n  srtp: 'SRTP_AEAD_AES_128_GCM:SRTP_AES128_CM_SHA1_80',\n});\n\nawait session.opened;\nconsole.log('Negotiated SRTP:', session.srtpProfile);\nconst keys = session.exportKeyingMaterial(60, 'EXTRACTOR-dtls_srtp');\n</code></pre>",
          "displayName": "DTLS-SRTP example"
        },
        {
          "textRaw": "MTU considerations",
          "name": "mtu_considerations",
          "type": "module",
          "desc": "<p>Since libuv does not currently support path MTU discovery, the DTLS module\nuses a conservative default MTU of 1200 bytes. This value works across\nvirtually all network paths but may be suboptimal for local networks.</p>\n<p>This bounds the UDP payload, not the application payload: a record carries\nsomewhat less once its header and MAC are accounted for. It is fixed when the\nendpoint is created and cannot be changed afterwards. It does not bound\n<a href=\"#sessionsenddata\"><code>session.send()</code></a>, which is limited by the DTLS record size instead.</p>\n<p>The MTU can be configured via the <code>mtu</code> option:</p>\n<pre><code class=\"language-mjs\">// For a local network where you know the path MTU\nconst endpoint = listen(callback, {\n  // ...\n  mtu: 1400,\n});\n</code></pre>\n<p>The minimum allowed MTU is 256 bytes. The maximum is 65535.</p>",
          "displayName": "MTU considerations"
        }
      ],
      "methods": [
        {
          "textRaw": "`dtls.listen(callback, options)`",
          "name": "listen",
          "type": "method",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`callback` {Function} Called for each new DTLS session accepted by the server.",
                  "name": "callback",
                  "type": "Function",
                  "desc": "Called for each new DTLS session accepted by the server.",
                  "options": [
                    {
                      "textRaw": "`session` {DTLSSession} The new session.",
                      "name": "session",
                      "type": "DTLSSession",
                      "desc": "The new session."
                    }
                  ]
                },
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`cert` {string|Buffer} Server certificate in PEM format. **Required.**",
                      "name": "cert",
                      "type": "string|Buffer",
                      "desc": "Server certificate in PEM format. **Required.**"
                    },
                    {
                      "textRaw": "`key` {string|Buffer} Server private key in PEM format. **Required.**",
                      "name": "key",
                      "type": "string|Buffer",
                      "desc": "Server private key in PEM format. **Required.**"
                    },
                    {
                      "textRaw": "`secureContext` {DTLSSecureContext} A context from `dtls.createSecureContext()` to use instead of building one from the credential options below. Must have been created with `isServer: true`. Cannot be combined with any option the context already carries.",
                      "name": "secureContext",
                      "type": "DTLSSecureContext",
                      "desc": "A context from `dtls.createSecureContext()` to use instead of building one from the credential options below. Must have been created with `isServer: true`. Cannot be combined with any option the context already carries."
                    },
                    {
                      "textRaw": "`sni` {Object|Function} Server Name Indication. A map of host names to the identity to serve them with, or a function returning one. Cannot be combined with `secureContext`; set it on the context instead. See Server Name Indication.",
                      "name": "sni",
                      "type": "Object|Function",
                      "desc": "Server Name Indication. A map of host names to the identity to serve them with, or a function returning one. Cannot be combined with `secureContext`; set it on the context instead. See Server Name Indication."
                    },
                    {
                      "textRaw": "`passphrase` {string} Passphrase to decrypt `key`, if it is encrypted. Ignored when `key` is not encrypted. Unlike `key` and `cert`, this must be a string, matching `tls.createSecureContext()`.",
                      "name": "passphrase",
                      "type": "string",
                      "desc": "Passphrase to decrypt `key`, if it is encrypted. Ignored when `key` is not encrypted. Unlike `key` and `cert`, this must be a string, matching `tls.createSecureContext()`."
                    },
                    {
                      "textRaw": "`port` {number} Port to bind to. **Required.**",
                      "name": "port",
                      "type": "number",
                      "desc": "Port to bind to. **Required.**"
                    },
                    {
                      "textRaw": "`host` {string} Address to bind to. **Default:** `'0.0.0.0'`.",
                      "name": "host",
                      "type": "string",
                      "default": "`'0.0.0.0'`",
                      "desc": "Address to bind to."
                    },
                    {
                      "textRaw": "`ca` {string|Buffer|string}[] | {Buffer}[] CA certificates in PEM format.",
                      "name": "ca",
                      "type": "string|Buffer|string",
                      "desc": "[] | {Buffer}[] CA certificates in PEM format."
                    },
                    {
                      "textRaw": "`ciphers` {string} OpenSSL cipher list string.",
                      "name": "ciphers",
                      "type": "string",
                      "desc": "OpenSSL cipher list string."
                    },
                    {
                      "textRaw": "`alpn` {string}[] | {Buffer} ALPN protocol names. Each name must be between 1 and 255 bytes. A `Buffer` must already be in ALPN wire format: one length byte followed by that many bytes, repeated.",
                      "name": "alpn",
                      "type": "string",
                      "desc": "[] | {Buffer} ALPN protocol names. Each name must be between 1 and 255 bytes. A `Buffer` must already be in ALPN wire format: one length byte followed by that many bytes, repeated."
                    },
                    {
                      "textRaw": "`srtp` {string} Colon-separated SRTP protection profile names (e.g., `'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM'`).",
                      "name": "srtp",
                      "type": "string",
                      "desc": "Colon-separated SRTP protection profile names (e.g., `'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM'`)."
                    },
                    {
                      "textRaw": "`requestCert` {boolean} Request a certificate from the client. **Default:** `false`.",
                      "name": "requestCert",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "Request a certificate from the client."
                    },
                    {
                      "textRaw": "`rejectUnauthorized` {boolean} Only has an effect together with `requestCert`. When `true`, a client that presents no certificate, or one that does not chain to a trusted CA, is rejected during the handshake and receives a TLS alert. When `false`, the certificate is still requested and verified but the handshake completes regardless, leaving the decision to the application via `session.authorized`. **Default:** `true`.",
                      "name": "rejectUnauthorized",
                      "type": "boolean",
                      "default": "`true`",
                      "desc": "Only has an effect together with `requestCert`. When `true`, a client that presents no certificate, or one that does not chain to a trusted CA, is rejected during the handshake and receives a TLS alert. When `false`, the certificate is still requested and verified but the handshake completes regardless, leaving the decision to the application via `session.authorized`."
                    },
                    {
                      "textRaw": "`mtu` {number} Maximum size in bytes of a DTLS datagram. **Default:** `1200`.",
                      "name": "mtu",
                      "type": "number",
                      "default": "`1200`",
                      "desc": "Maximum size in bytes of a DTLS datagram."
                    },
                    {
                      "textRaw": "`handshakeTimeout` {number} Milliseconds a handshake may take before it is abandoned. `0` disables it. **Default:** `60000`. See Handshake timeout.",
                      "name": "handshakeTimeout",
                      "type": "number",
                      "default": "`60000`. See Handshake timeout",
                      "desc": "Milliseconds a handshake may take before it is abandoned. `0` disables it."
                    },
                    {
                      "textRaw": "`ipv6Only` {boolean} When `true`, an IPv6 endpoint serves IPv6 only. When `false`, binding `'::'` also accepts IPv4 peers, which arrive with mapped addresses such as `'::ffff:203.0.113.1'` -- anything keyed on the peer address, including `maxSessionsPerHost`, sees them in that form. Has no effect on an IPv4 endpoint. **Default:** `false`.",
                      "name": "ipv6Only",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "When `true`, an IPv6 endpoint serves IPv6 only. When `false`, binding `'::'` also accepts IPv4 peers, which arrive with mapped addresses such as `'::ffff:203.0.113.1'` -- anything keyed on the peer address, including `maxSessionsPerHost`, sees them in that form. Has no effect on an IPv4 endpoint."
                    },
                    {
                      "textRaw": "`reusePort` {boolean} When `true`, sets `SO_REUSEPORT`, so several processes may bind the same port and the kernel spreads arriving datagrams between them. Every one of them must set it. **Default:** `false`.",
                      "name": "reusePort",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "When `true`, sets `SO_REUSEPORT`, so several processes may bind the same port and the kernel spreads arriving datagrams between them. Every one of them must set it."
                    },
                    {
                      "textRaw": "`udpReceiveBufferSize` {number} Size in bytes for the socket's receive buffer (`SO_RCVBUF`). Raising it gives the endpoint room for bursts that the default would drop. The kernel clamps this to its own maximum. **Default:** the system default.",
                      "name": "udpReceiveBufferSize",
                      "type": "number",
                      "default": "the system default",
                      "desc": "Size in bytes for the socket's receive buffer (`SO_RCVBUF`). Raising it gives the endpoint room for bursts that the default would drop. The kernel clamps this to its own maximum."
                    },
                    {
                      "textRaw": "`udpSendBufferSize` {number} Size in bytes for the socket's send buffer (`SO_SNDBUF`). Clamped as above. **Default:** the system default.",
                      "name": "udpSendBufferSize",
                      "type": "number",
                      "default": "the system default",
                      "desc": "Size in bytes for the socket's send buffer (`SO_SNDBUF`). Clamped as above."
                    },
                    {
                      "textRaw": "`udpTTL` {number} IP time-to-live for outgoing datagrams, from `1` to `255`. **Default:** the system default.",
                      "name": "udpTTL",
                      "type": "number",
                      "default": "the system default",
                      "desc": "IP time-to-live for outgoing datagrams, from `1` to `255`."
                    },
                    {
                      "textRaw": "`maxSessions` {number} The maximum number of concurrent sessions the endpoint will hold. Set to `0` for no limit. **Default:** `10000`.",
                      "name": "maxSessions",
                      "type": "number",
                      "default": "`10000`",
                      "desc": "The maximum number of concurrent sessions the endpoint will hold. Set to `0` for no limit."
                    },
                    {
                      "textRaw": "`maxSessionsPerHost` {number} The maximum number of concurrent sessions from any single source IP address, ignoring port. Set to `0` for no limit. **Default:** `1000`.",
                      "name": "maxSessionsPerHost",
                      "type": "number",
                      "default": "`1000`",
                      "desc": "The maximum number of concurrent sessions from any single source IP address, ignoring port. Set to `0` for no limit."
                    },
                    {
                      "textRaw": "`sessionIdContext` {string} Opaque identifier scoping resumable sessions to this server, at most 32 bytes. **Default:** a value derived from `process.argv`, as in `tls.createServer()`.",
                      "name": "sessionIdContext",
                      "type": "string",
                      "default": "a value derived from `process.argv`, as in `tls.createServer()`",
                      "desc": "Opaque identifier scoping resumable sessions to this server, at most 32 bytes."
                    }
                  ]
                }
              ],
              "return": {
                "textRaw": "Returns: {DTLSEndpoint}",
                "name": "return",
                "type": "DTLSEndpoint"
              }
            }
          ],
          "desc": "<p>Creates a DTLS server bound to the specified address and port. The server\nuses automatic HMAC-based cookie exchange for DoS protection. See\n<a href=\"#denial-of-service\">Denial of service</a>.</p>\n<p>Binding failures are thrown with the code the operating system gave, as in\n<code>net</code> and <code>dgram</code>: an address already in use throws an error whose <code>code</code> is\n<code>'EADDRINUSE'</code>, with <code>errno</code> and <code>syscall</code> set.</p>\n<pre><code class=\"language-mjs\">import { listen } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst endpoint = listen((session) => {\n  session.onmessage = (data) => {\n    console.log('Received:', data.toString());\n    session.send('pong');\n  };\n\n  session.onhandshake = (protocol) => {\n    console.log('Handshake complete:', protocol);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 4433,\n});\n\nconsole.log('DTLS server listening on', endpoint.address);\n</code></pre>"
        },
        {
          "textRaw": "`dtls.connect(host, port[, options])`",
          "name": "connect",
          "type": "method",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`host` {string} Remote host to connect to, as an IPv4 or IPv6 literal. Host names are not resolved.",
                  "name": "host",
                  "type": "string",
                  "desc": "Remote host to connect to, as an IPv4 or IPv6 literal. Host names are not resolved."
                },
                {
                  "textRaw": "`port` {number} Remote port to connect to.",
                  "name": "port",
                  "type": "number",
                  "desc": "Remote port to connect to."
                },
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`ca` {string|Buffer|string}[] | {Buffer}[] CA certificates in PEM format.",
                      "name": "ca",
                      "type": "string|Buffer|string",
                      "desc": "[] | {Buffer}[] CA certificates in PEM format."
                    },
                    {
                      "textRaw": "`cert` {string|Buffer} Client certificate in PEM format.",
                      "name": "cert",
                      "type": "string|Buffer",
                      "desc": "Client certificate in PEM format."
                    },
                    {
                      "textRaw": "`key` {string|Buffer} Client private key in PEM format.",
                      "name": "key",
                      "type": "string|Buffer",
                      "desc": "Client private key in PEM format."
                    },
                    {
                      "textRaw": "`secureContext` {DTLSSecureContext} A context from `dtls.createSecureContext()` to use instead of building one from the credential options below. Must **not** have been created with `isServer: true`. Cannot be combined with any option the context already carries.",
                      "name": "secureContext",
                      "type": "DTLSSecureContext",
                      "desc": "A context from `dtls.createSecureContext()` to use instead of building one from the credential options below. Must **not** have been created with `isServer: true`. Cannot be combined with any option the context already carries."
                    },
                    {
                      "textRaw": "`psk` {Object|Function} A pre-shared key as `{ identity, key }`, or a function returning one. See Pre-shared keys.",
                      "name": "psk",
                      "type": "Object|Function",
                      "desc": "A pre-shared key as `{ identity, key }`, or a function returning one. See Pre-shared keys."
                    },
                    {
                      "textRaw": "`session` {Buffer} A session from `session.session` on an earlier connection, to resume rather than handshake in full. See Session resumption.",
                      "name": "session",
                      "type": "Buffer",
                      "desc": "A session from `session.session` on an earlier connection, to resume rather than handshake in full. See Session resumption."
                    },
                    {
                      "textRaw": "`passphrase` {string} Passphrase to decrypt `key`, if it is encrypted. Ignored when `key` is not encrypted. Unlike `key` and `cert`, this must be a string, matching `tls.createSecureContext()`.",
                      "name": "passphrase",
                      "type": "string",
                      "desc": "Passphrase to decrypt `key`, if it is encrypted. Ignored when `key` is not encrypted. Unlike `key` and `cert`, this must be a string, matching `tls.createSecureContext()`."
                    },
                    {
                      "textRaw": "`rejectUnauthorized` {boolean} When `true`, the server's certificate must both chain to a trusted CA and match the expected identity (`servername`, or `host` when `servername` is not set); otherwise the handshake is aborted and `session.opened` rejects. When `false`, the certificate is still verified and the handshake completes regardless, leaving the decision to the application via `session.authorized` and `session.authorizationError`. **Default:** `true`.",
                      "name": "rejectUnauthorized",
                      "type": "boolean",
                      "default": "`true`",
                      "desc": "When `true`, the server's certificate must both chain to a trusted CA and match the expected identity (`servername`, or `host` when `servername` is not set); otherwise the handshake is aborted and `session.opened` rejects. When `false`, the certificate is still verified and the handshake completes regardless, leaving the decision to the application via `session.authorized` and `session.authorizationError`."
                    },
                    {
                      "textRaw": "`servername` {string} Server name used for the SNI (Server Name Indication) extension and as the identity checked during certificate verification. **Default:** the `host` argument. Set to `''` to disable SNI. SNI is never sent for IP address literals.",
                      "name": "servername",
                      "type": "string",
                      "default": "the `host` argument. Set to `''` to disable SNI. SNI is never sent for IP address literals",
                      "desc": "Server name used for the SNI (Server Name Indication) extension and as the identity checked during certificate verification."
                    },
                    {
                      "textRaw": "`bindHost` {string} Local bind address. **Default:** `'::'` when `host` is an IPv6 literal, otherwise `'0.0.0.0'`. The local socket must be in the same address family as the peer.",
                      "name": "bindHost",
                      "type": "string",
                      "default": "`'::'` when `host` is an IPv6 literal, otherwise `'0.0.0.0'`. The local socket must be in the same address family as the peer",
                      "desc": "Local bind address."
                    },
                    {
                      "textRaw": "`bindPort` {number} Local bind port. **Default:** `0` (ephemeral).",
                      "name": "bindPort",
                      "type": "number",
                      "default": "`0` (ephemeral)",
                      "desc": "Local bind port."
                    },
                    {
                      "textRaw": "`alpn` {string}[] | {Buffer} ALPN protocol names. Each name must be between 1 and 255 bytes. A `Buffer` must already be in ALPN wire format: one length byte followed by that many bytes, repeated.",
                      "name": "alpn",
                      "type": "string",
                      "desc": "[] | {Buffer} ALPN protocol names. Each name must be between 1 and 255 bytes. A `Buffer` must already be in ALPN wire format: one length byte followed by that many bytes, repeated."
                    },
                    {
                      "textRaw": "`srtp` {string} SRTP protection profile names.",
                      "name": "srtp",
                      "type": "string",
                      "desc": "SRTP protection profile names."
                    },
                    {
                      "textRaw": "`mtu` {number} Maximum size in bytes of a DTLS datagram. **Default:** `1200`.",
                      "name": "mtu",
                      "type": "number",
                      "default": "`1200`",
                      "desc": "Maximum size in bytes of a DTLS datagram."
                    },
                    {
                      "textRaw": "`handshakeTimeout` {number} Milliseconds a handshake may take before it is abandoned and `session.opened` rejects. `0` disables it. **Default:** `60000`. See Handshake timeout.",
                      "name": "handshakeTimeout",
                      "type": "number",
                      "default": "`60000`. See Handshake timeout",
                      "desc": "Milliseconds a handshake may take before it is abandoned and `session.opened` rejects. `0` disables it."
                    }
                  ],
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {DTLSSession}",
                "name": "return",
                "type": "DTLSSession"
              }
            }
          ],
          "desc": "<p>Connects to a DTLS server. Returns a <code>DTLSSession</code> whose <code>opened</code> property\nis a <code>Promise</code> that resolves when the handshake completes.</p>\n<pre><code class=\"language-mjs\">import { connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst session = connect('127.0.0.1', 4433, {\n  ca: [readFileSync('ca-cert.pem')],\n});\n\nawait session.opened;\nsession.send('hello');\n\nsession.onmessage = (data) => {\n  console.log('Received:', data.toString());\n};\n</code></pre>"
        },
        {
          "textRaw": "`dtls.createSecureContext([options])`",
          "name": "createSecureContext",
          "type": "method",
          "meta": {
            "added": [
              "v26.10.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`alpn` {string}[] ALPN protocols.",
                      "name": "alpn",
                      "type": "string",
                      "desc": "[] ALPN protocols."
                    },
                    {
                      "textRaw": "`ca` {string|Buffer|Array} CA certificates in PEM format. When omitted, the bundled default certificate authorities are used.",
                      "name": "ca",
                      "type": "string|Buffer|Array",
                      "desc": "CA certificates in PEM format. When omitted, the bundled default certificate authorities are used."
                    },
                    {
                      "textRaw": "`cert` {string|Buffer} Certificate in PEM format.",
                      "name": "cert",
                      "type": "string|Buffer",
                      "desc": "Certificate in PEM format."
                    },
                    {
                      "textRaw": "`ciphers` {string} OpenSSL cipher suite list.",
                      "name": "ciphers",
                      "type": "string",
                      "desc": "OpenSSL cipher suite list."
                    },
                    {
                      "textRaw": "`ecdhCurve` {string} Named curve or curve list for ECDH.",
                      "name": "ecdhCurve",
                      "type": "string",
                      "desc": "Named curve or curve list for ECDH."
                    },
                    {
                      "textRaw": "`isServer` {boolean} Build a context for a server. **Default:** `false`.",
                      "name": "isServer",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "Build a context for a server."
                    },
                    {
                      "textRaw": "`key` {string|Buffer} Private key in PEM format.",
                      "name": "key",
                      "type": "string|Buffer",
                      "desc": "Private key in PEM format."
                    },
                    {
                      "textRaw": "`passphrase` {string} Passphrase for `key`, if it is encrypted.",
                      "name": "passphrase",
                      "type": "string",
                      "desc": "Passphrase for `key`, if it is encrypted."
                    },
                    {
                      "textRaw": "`rejectUnauthorized` {boolean} Verification behaviour, as for `dtls.listen()` and `dtls.connect()`.",
                      "name": "rejectUnauthorized",
                      "type": "boolean",
                      "desc": "Verification behaviour, as for `dtls.listen()` and `dtls.connect()`."
                    },
                    {
                      "textRaw": "`requestCert` {boolean} Request a certificate from the peer. Servers only.",
                      "name": "requestCert",
                      "type": "boolean",
                      "desc": "Request a certificate from the peer. Servers only."
                    },
                    {
                      "textRaw": "`sessionIdContext` {string} Session id context. Servers only.",
                      "name": "sessionIdContext",
                      "type": "string",
                      "desc": "Session id context. Servers only."
                    },
                    {
                      "textRaw": "`sni` {Object|Function} Server Name Indication. Servers only. See Server Name Indication.",
                      "name": "sni",
                      "type": "Object|Function",
                      "desc": "Server Name Indication. Servers only. See Server Name Indication."
                    },
                    {
                      "textRaw": "`psk` {Object|Function} Pre-shared keys. See Pre-shared keys.",
                      "name": "psk",
                      "type": "Object|Function",
                      "desc": "Pre-shared keys. See Pre-shared keys."
                    },
                    {
                      "textRaw": "`pskIdentityHint` {string} Identity hint to advertise, naming which key a client should pick. Requires `psk`. Servers only.",
                      "name": "pskIdentityHint",
                      "type": "string",
                      "desc": "Identity hint to advertise, naming which key a client should pick. Requires `psk`. Servers only."
                    },
                    {
                      "textRaw": "`srtp` {string} SRTP profile list.",
                      "name": "srtp",
                      "type": "string",
                      "desc": "SRTP profile list."
                    },
                    {
                      "textRaw": "`ticketKeys` {Buffer} Session ticket keys, for resuming sessions across endpoints and restarts. Servers only. See Session resumption.",
                      "name": "ticketKeys",
                      "type": "Buffer",
                      "desc": "Session ticket keys, for resuming sessions across endpoints and restarts. Servers only. See Session resumption."
                    }
                  ],
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {DTLSSecureContext}",
                "name": "return",
                "type": "DTLSSecureContext"
              }
            }
          ],
          "desc": "<p>Options marked \"Servers only\" require <code>isServer: true</code>. Passing one to a\nclient context throws <code>ERR_INVALID_ARG_VALUE</code>, rather than being ignored or\napplied where it can have no effect.</p>\n<p>Creates a reusable secure context. Pass it to <a href=\"#dtlslistencallback-options\"><code>dtls.listen()</code></a> or\n<a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a> as <code>secureContext</code> in place of the credential options.</p>\n<p>A context holds a parsed certificate and key and, when <code>ca</code> is given, its own\ncertificate store; roughly 28 KiB in total. Building one per connection is\ntherefore expensive in memory rather than in time -- two thousand of them cost\nabout 54 MiB, against 2 MiB when a single context is shared. Clients opening\nmany connections should build the context once.</p>\n<p>The peer identity checked during verification is <strong>not</strong> part of the context.\nIt is bound to each connection from <code>servername</code> (or the host), so one context\ncan be used against different peers and still reject the wrong certificate.</p>\n<p><code>isServer</code> is fixed when the context is created, because it selects the\nunderlying OpenSSL method. Passing a server context to <a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a>,\nor a client context to <a href=\"#dtlslistencallback-options\"><code>dtls.listen()</code></a>, throws.</p>\n<pre><code class=\"language-mjs\">import { connect, createSecureContext, listen } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst serverContext = createSecureContext({\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  isServer: true,\n});\n\n// One context, several endpoints.\nconst a = listen(onsession, { secureContext: serverContext, port: 5684 });\nconst b = listen(onsession, { secureContext: serverContext, port: 5685 });\n\nconst clientContext = createSecureContext({\n  ca: readFileSync('ca-cert.pem'),\n});\n\n// One context, many connections, each verified against its own name.\nconst s1 = connect('192.0.2.1', 5684, {\n  secureContext: clientContext,\n  servername: 'a.example.com',\n});\nconst s2 = connect('192.0.2.2', 5684, {\n  secureContext: clientContext,\n  servername: 'b.example.com',\n});\n</code></pre>"
        }
      ],
      "classes": [
        {
          "textRaw": "Class: `DTLSSecureContext`",
          "name": "DTLSSecureContext",
          "type": "class",
          "meta": {
            "added": [
              "v26.10.0"
            ],
            "changes": []
          },
          "desc": "<p>An opaque, reusable bundle of credentials and TLS settings, created by\n<a href=\"#dtlscreatesecurecontextoptions\"><code>dtls.createSecureContext()</code></a>. It cannot be constructed directly.</p>",
          "properties": [
            {
              "textRaw": "Returns: {boolean} `true` if the context was created for a server.",
              "name": "isServer",
              "type": "boolean",
              "desc": "`true` if the context was created for a server."
            }
          ]
        },
        {
          "textRaw": "Class: `DTLSEndpoint`",
          "name": "DTLSEndpoint",
          "type": "class",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "desc": "<p>Manages a UDP socket and multiplexes DTLS sessions.</p>",
          "properties": [
            {
              "textRaw": "Returns: {Object} `{ address, family, port }`",
              "name": "address",
              "type": "Object",
              "desc": "<p>The local address the endpoint is bound to.</p>",
              "shortDesc": "`{ address, family, port }`"
            },
            {
              "textRaw": "Type: {DTLSEndpoint.Stats}",
              "name": "stats",
              "type": "DTLSEndpoint.Stats",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "<p>The statistics collected for this endpoint. Read only. The stats object is\nlive and updated as data flows through the endpoint.</p>"
            },
            {
              "textRaw": "{boolean}",
              "name": "busy",
              "type": "boolean",
              "desc": "<p>When <code>true</code>, the endpoint rejects new incoming connections. Can be set\nto implement backpressure.</p>"
            },
            {
              "textRaw": "{boolean} True once the endpoint has been destroyed.",
              "name": "destroyed",
              "type": "boolean",
              "desc": "True once the endpoint has been destroyed."
            },
            {
              "textRaw": "{Promise} Resolves when the endpoint has fully closed.",
              "name": "closed",
              "type": "Promise",
              "desc": "Resolves when the endpoint has fully closed."
            }
          ],
          "methods": [
            {
              "textRaw": "`endpoint.close()`",
              "name": "close",
              "type": "method",
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Promise} Resolves when the endpoint is fully closed.",
                    "name": "return",
                    "type": "Promise",
                    "desc": "Resolves when the endpoint is fully closed."
                  }
                }
              ],
              "desc": "<p>Gracefully closes the endpoint. All active sessions are closed with\n<code>close_notify</code> alerts before the UDP socket is released.</p>"
            },
            {
              "textRaw": "`endpoint.destroy([error])`",
              "name": "destroy",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "error",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Immediately destroys the endpoint without sending <code>close_notify</code> alerts.</p>"
            },
            {
              "textRaw": "`endpoint[Symbol.asyncDispose]()`",
              "name": "[Symbol.asyncDispose]",
              "type": "method",
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Equivalent to calling <code>endpoint.close()</code>.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `DTLSEndpoint.Stats`",
          "name": "DTLSEndpoint.Stats",
          "type": "class",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "desc": "<p>A view of the collected statistics for an endpoint.</p>",
          "properties": [
            {
              "textRaw": "Type: {bigint} A timestamp indicating when the endpoint was created. Read only.",
              "name": "createdAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when the endpoint was created. Read only."
            },
            {
              "textRaw": "Type: {bigint} A timestamp indicating when the endpoint was destroyed. Read only.",
              "name": "destroyedAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when the endpoint was destroyed. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of bytes received by this endpoint. Read only.",
              "name": "bytesReceived",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of bytes received by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of bytes sent by this endpoint. Read only.",
              "name": "bytesSent",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of bytes sent by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of UDP packets received by this endpoint. Read only.",
              "name": "packetsReceived",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of UDP packets received by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of UDP packets sent by this endpoint. Read only.",
              "name": "packetsSent",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of UDP packets sent by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of peer-initiated sessions accepted by this endpoint. Read only.",
              "name": "serverSessions",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of peer-initiated sessions accepted by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of sessions initiated by this endpoint. Read only.",
              "name": "clientSessions",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of sessions initiated by this endpoint. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of incoming connections rejected because the endpoint was marked busy. Read only.",
              "name": "serverBusyCount",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of incoming connections rejected because the endpoint was marked busy. Read only."
            },
            {
              "textRaw": "Type: {bigint} The number of datagrams discarded before a handshake was attempted because they could not be a ClientHello. Read only.",
              "name": "serverRejectedCount",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "<p>Datagrams arriving at a listening endpoint that do not match an existing\nsession are screened for the shape of a DTLS ClientHello record before any\nstate is allocated for them. A steadily rising value indicates junk or scan\ntraffic rather than failing clients, which are counted as sessions that never\ncomplete.</p>",
              "shortDesc": "The number of datagrams discarded before a handshake was attempted because they could not be a ClientHello. Read only."
            },
            {
              "textRaw": "Type: {bigint} The number of otherwise valid handshake attempts refused because the endpoint was at `maxSessions` or the peer was at `maxSessionsPerHost`. Read only.",
              "name": "serverRefusedCount",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "The number of otherwise valid handshake attempts refused because the endpoint was at `maxSessions` or the peer was at `maxSessionsPerHost`. Read only."
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "isConnected",
              "type": "boolean",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "<p><code>true</code> if the stats object is still connected to the underlying endpoint.\nOnce the endpoint is destroyed, the stats become a stale snapshot.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `DTLSSession`",
          "name": "DTLSSession",
          "type": "class",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "desc": "<p>Represents a DTLS association with a single remote peer.</p>",
          "methods": [
            {
              "textRaw": "`session.send(data)`",
              "name": "send",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`data` {string|Buffer|TypedArray|DataView} The data to send. At most 16384 bytes. A view sends the bytes it covers, so an offset or a subarray is sent as given rather than as the whole buffer behind it.",
                      "name": "data",
                      "type": "string|Buffer|TypedArray|DataView",
                      "desc": "The data to send. At most 16384 bytes. A view sends the bytes it covers, so an offset or a subarray is sent as given rather than as the whole buffer behind it."
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {number} The number of bytes written to the DTLS layer.",
                    "name": "return",
                    "type": "number",
                    "desc": "The number of bytes written to the DTLS layer."
                  }
                }
              ],
              "desc": "<p>Send application data to the peer. The data is encrypted by DTLS before\nbeing sent over UDP. Can only be called after the handshake completes\n(<code>session.opened</code> has resolved).</p>\n<p>DTLS carries application data in a single record per datagram and does not\nfragment it, so <code>data</code> must fit in one record. Sending more throws\n<code>ERR_OUT_OF_RANGE</code>. This limit is independent of the <code>mtu</code> option: a record\nlarger than the path MTU is still sent, and is fragmented by IP.</p>\n<p>Throws <code>ERR_INVALID_STATE</code> if the handshake has not completed, or if the\nsession is closed or destroyed.</p>\n<p>A successful return means the data was handed to the DTLS layer and written\nto the socket, not that the peer received it. DTLS runs over UDP, so\napplication data may still be lost in transit.</p>"
            },
            {
              "textRaw": "`session.close()`",
              "name": "close",
              "type": "method",
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Promise} Resolves when the session is closed.",
                    "name": "return",
                    "type": "Promise",
                    "desc": "Resolves when the session is closed."
                  }
                }
              ],
              "desc": "<p>Initiates a graceful DTLS shutdown by sending a <code>close_notify</code> alert.</p>"
            },
            {
              "textRaw": "`session.destroy([error])`",
              "name": "destroy",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "error",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Immediately destroys the session without sending <code>close_notify</code>.</p>"
            },
            {
              "textRaw": "`session.exportKeyingMaterial(length, label[, context])`",
              "name": "exportKeyingMaterial",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`length` {number} Number of bytes to export. Must be an integer between `1` and `65536`.",
                      "name": "length",
                      "type": "number",
                      "desc": "Number of bytes to export. Must be an integer between `1` and `65536`."
                    },
                    {
                      "textRaw": "`label` {string} The label for the exported keying material.",
                      "name": "label",
                      "type": "string",
                      "desc": "The label for the exported keying material."
                    },
                    {
                      "textRaw": "`context` {Buffer} Optional context value.",
                      "name": "context",
                      "type": "Buffer",
                      "desc": "Optional context value.",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {Buffer}",
                    "name": "return",
                    "type": "Buffer"
                  }
                }
              ],
              "desc": "<p>Exports keying material from the DTLS session, as defined in\n<a href=\"https://www.rfc-editor.org/rfc/rfc5705\">RFC 5705</a>. This is commonly used with DTLS-SRTP to derive\nencryption keys for media streams.</p>\n<p>Throws <code>ERR_OUT_OF_RANGE</code> if <code>length</code> is outside the accepted range. The upper\nbound is not imposed by <a href=\"https://www.rfc-editor.org/rfc/rfc5705\">RFC 5705</a>; it exists so that a caller cannot request\nan arbitrarily large allocation, and is far above what any defined exporter\nneeds (DTLS-SRTP uses 60 bytes).</p>"
            },
            {
              "textRaw": "`session[Symbol.asyncDispose]()`",
              "name": "[Symbol.asyncDispose]",
              "type": "method",
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Equivalent to calling <code>session.close()</code>.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "{boolean} True once the session has been destroyed, whether by `session.destroy()`, by a close, or by its endpoint going away.",
              "name": "destroyed",
              "type": "boolean",
              "desc": "True once the session has been destroyed, whether by `session.destroy()`, by a close, or by its endpoint going away."
            },
            {
              "textRaw": "`session.endpoint`",
              "name": "endpoint",
              "type": "property",
              "desc": "<ul>\n<li>{DTLSEndpoint} The endpoint carrying this session. For a session from <a href=\"#dtlslistencallback-options\"><code>dtls.listen()</code></a> this is the listening endpoint, shared with every other\nsession on it; for one from <a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a> it is the endpoint created\nto carry that session alone.</li>\n</ul>"
            },
            {
              "textRaw": "{string|undefined} The server name for this session: the name the client sent in the SNI extension, read on either side of the connection. `undefined` when no name was sent. See Server name indication.",
              "name": "servername",
              "type": "string|undefined",
              "desc": "The server name for this session: the name the client sent in the SNI extension, read on either side of the connection. `undefined` when no name was sent. See Server name indication."
            },
            {
              "textRaw": "{Promise} Resolves with `{ protocol }` when the DTLS handshake completes.",
              "name": "opened",
              "type": "Promise",
              "desc": "<p>Rejects if the handshake fails, and also if the session is closed or\ndestroyed before the handshake completes -- in that case with\n<code>ERR_INVALID_STATE</code>, or with the error passed to\n<a href=\"#sessiondestroyerror\"><code>session.destroy()</code></a> if one was given. The promise always settles, so\nawaiting it cannot hang.</p>",
              "shortDesc": "Resolves with `{ protocol }` when the DTLS handshake completes."
            },
            {
              "textRaw": "{Promise} Settles when the session is fully closed. Resolves when the close was graceful, and rejects with the error when the session was destroyed with one, or when its endpoint was. The promise always settles, so awaiting it cannot hang.",
              "name": "closed",
              "type": "Promise",
              "desc": "Settles when the session is fully closed. Resolves when the close was graceful, and rejects with the error when the session was destroyed with one, or when its endpoint was. The promise always settles, so awaiting it cannot hang."
            },
            {
              "textRaw": "Returns: {Object} `{ address, family, port }`",
              "name": "remoteAddress",
              "type": "Object",
              "desc": "`{ address, family, port }`"
            },
            {
              "textRaw": "Returns: {string} The negotiated DTLS protocol version (e.g., `'DTLSv1.2'`).",
              "name": "protocol",
              "type": "string",
              "desc": "The negotiated DTLS protocol version (e.g., `'DTLSv1.2'`)."
            },
            {
              "textRaw": "Returns: {Object} `{ name, standardName, version }`",
              "name": "cipher",
              "type": "Object",
              "desc": "`{ name, standardName, version }`"
            },
            {
              "textRaw": "Returns: {string|undefined} The peer's certificate in PEM format, or `undefined` if the peer sent none.",
              "name": "peerCertificate",
              "type": "string|undefined",
              "desc": "<p>This is the leaf certificate as PEM text and nothing else. For the issuer chain\nand the parsed fields, use <a href=\"#sessionpeerx509certificate\"><code>session.peerX509Certificate</code></a>, whose <code>toString()</code>\nreturns this same PEM. Use <a href=\"#sessionauthorized\"><code>session.authorized</code></a> and\n<a href=\"#sessionauthorizationerror\"><code>session.authorizationError</code></a> for the verification result rather than\nparsing either.</p>",
              "shortDesc": "The peer's certificate in PEM format, or `undefined` if the peer sent none."
            },
            {
              "textRaw": "Returns: {X509Certificate|undefined} The peer's certificate, or `undefined` if the peer sent none.",
              "name": "peerX509Certificate",
              "type": "X509Certificate|undefined",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "<p>An <a href=\"crypto.html#class-x509certificate\"><code>X509Certificate</code></a> for the peer's leaf certificate. The issuer chain is\nreachable through its <code>issuerCertificate</code> property, and the parsed fields --\n<code>subject</code>, <code>issuer</code>, <code>validFrom</code>, <code>validTo</code>, <code>fingerprint256</code>, <code>serialNumber</code>\nand the rest -- are properties of that object.</p>\n<p>Where <a href=\"tls.html#tlssocketgetpeercertificatedetailed\"><code>tls.TLSSocket.getPeerCertificate()</code></a> returns a plain dictionary with\n<code>valid_from</code>, <code>valid_to</code> and a chain walked through <code>issuerCertificate</code>, this\nreturns the same <code>X509Certificate</code> class that\n<a href=\"tls.html#tlssocketgetpeerx509certificate\"><code>tls.TLSSocket.getPeerX509Certificate()</code></a> does. Call <code>toLegacyObject()</code> on\nit to get the dictionary form.</p>\n<p>The same object is returned on every access once the peer's certificate is\navailable.</p>",
              "shortDesc": "The peer's certificate, or `undefined` if the peer sent none."
            },
            {
              "textRaw": "Returns: {Buffer|undefined} An opaque session for resuming this connection later, or `undefined` on a server session or before the handshake completes.",
              "name": "session",
              "type": "Buffer|undefined",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "<p>Pass it as the <code>session</code> option to a later <a href=\"#dtlsconnecthost-port-options\"><code>dtls.connect()</code></a>. It is bound to\nthe host this connection authenticated against and is refused elsewhere; see\n<a href=\"#session-resumption\">Session resumption</a>.</p>\n<p>Server sessions return <code>undefined</code>: a server has no identity to bind the value\nto, and it is the client that carries a session between connections.</p>",
              "shortDesc": "An opaque session for resuming this connection later, or `undefined` on a server session or before the handshake completes."
            },
            {
              "textRaw": "Returns: {boolean} `true` if this connection resumed an earlier session rather than performing a full handshake.",
              "name": "reused",
              "type": "boolean",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "<p>Like <a href=\"#sessionauthorized\"><code>session.authorized</code></a>, this reads <code>false</code> once the session is closed.</p>",
              "shortDesc": "`true` if this connection resumed an earlier session rather than performing a full handshake."
            },
            {
              "textRaw": "Returns: {boolean} `true` if the peer presented a certificate chain that verified against the configured certificate authorities, and, for a client, matched the requested identity. `false` before the handshake completes.",
              "name": "authorized",
              "type": "boolean",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "`true` if the peer presented a certificate chain that verified against the configured certificate authorities, and, for a client, matched the requested identity. `false` before the handshake completes."
            },
            {
              "textRaw": "Returns: {string|undefined} The short X509 verification error code, for example `'CERT_HAS_EXPIRED'` or `'HOSTNAME_MISMATCH'`, or `undefined` if the peer's chain verified.",
              "name": "authorizationError",
              "type": "string|undefined",
              "meta": {
                "added": [
                  "v26.10.0"
                ],
                "changes": []
              },
              "desc": "<p>A peer that presented no certificate at all reports\n<code>'UNABLE_TO_GET_ISSUER_CERT'</code>, so this can be used to distinguish \"no\ncertificate\" from \"a certificate that failed to verify\".</p>\n<p>The chain is verified even when <code>rejectUnauthorized</code> is <code>false</code>; the result is\nsimply not enforced. That makes these two properties the way to apply a custom\nauthorization policy:</p>\n<pre><code class=\"language-mjs\">import { connect } from 'node:dtls';\n\nconst session = connect('192.0.2.1', 4433, {\n  ca: [caCert],\n  servername: 'example.com',\n  rejectUnauthorized: false,\n});\n\nawait session.opened;\n\nif (!session.authorized &#x26;&#x26; session.authorizationError !== 'CERT_HAS_EXPIRED') {\n  await session.close();\n}\n</code></pre>",
              "shortDesc": "The short X509 verification error code, for example `'CERT_HAS_EXPIRED'` or `'HOSTNAME_MISMATCH'`, or `undefined` if the peer's chain verified."
            },
            {
              "textRaw": "Returns: {string|undefined} The negotiated ALPN protocol, or `undefined` if ALPN was not used.",
              "name": "alpnProtocol",
              "type": "string|undefined",
              "desc": "<p>If a server has <code>alpn</code> configured and a client offers only protocols the\nserver does not support, the server sends a fatal <code>no_application_protocol</code>\nalert and the handshake fails, as required by <a href=\"https://www.rfc-editor.org/rfc/rfc7301\">RFC 7301</a> section 3.2. A\nserver with no <code>alpn</code> configured declines the extension instead, and the\nhandshake completes with no protocol negotiated.</p>",
              "shortDesc": "The negotiated ALPN protocol, or `undefined` if ALPN was not used."
            },
            {
              "textRaw": "Returns: {string|undefined} The negotiated SRTP protection profile name.",
              "name": "srtpProfile",
              "type": "string|undefined",
              "desc": "The negotiated SRTP protection profile name."
            },
            {
              "textRaw": "Type: {DTLSSession.Stats}",
              "name": "stats",
              "type": "DTLSSession.Stats",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "<p>The statistics collected for this session. Read only. The stats object is\nlive and updated as data flows through the session.</p>"
            }
          ],
          "modules": [
            {
              "textRaw": "Callback properties",
              "name": "callback_properties",
              "type": "module",
              "properties": [
                {
                  "textRaw": "{Function}",
                  "name": "onmessage",
                  "type": "Function",
                  "desc": "<p>Set to receive application data from the peer.</p>",
                  "options": [
                    {
                      "textRaw": "`data` {Buffer}",
                      "name": "data",
                      "type": "Buffer"
                    }
                  ]
                },
                {
                  "textRaw": "{Function}",
                  "name": "onerror",
                  "type": "Function",
                  "desc": "<p>Set to receive error notifications.</p>",
                  "options": [
                    {
                      "textRaw": "`error` {Error}",
                      "name": "error",
                      "type": "Error"
                    }
                  ]
                },
                {
                  "textRaw": "{Function}",
                  "name": "onhandshake",
                  "type": "Function",
                  "desc": "<p>Set to receive handshake completion notifications.</p>",
                  "options": [
                    {
                      "textRaw": "`protocol` {string}",
                      "name": "protocol",
                      "type": "string"
                    }
                  ]
                },
                {
                  "textRaw": "{Function}",
                  "name": "onkeylog",
                  "type": "Function",
                  "desc": "<p>Set to receive TLS key log lines (for debugging with Wireshark).</p>",
                  "options": [
                    {
                      "textRaw": "`line` {string}",
                      "name": "line",
                      "type": "string"
                    }
                  ]
                }
              ],
              "displayName": "Callback properties"
            }
          ]
        },
        {
          "textRaw": "Class: `DTLSSession.Stats`",
          "name": "DTLSSession.Stats",
          "type": "class",
          "meta": {
            "added": [
              "v26.9.0"
            ],
            "changes": []
          },
          "desc": "<p>A view of the collected statistics for a session.</p>",
          "properties": [
            {
              "textRaw": "Type: {bigint} A timestamp indicating when the session was created. Read only.",
              "name": "createdAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when the session was created. Read only."
            },
            {
              "textRaw": "Type: {bigint} A timestamp indicating when the session was destroyed. Read only.",
              "name": "destroyedAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when the session was destroyed. Read only."
            },
            {
              "textRaw": "Type: {bigint} A timestamp indicating when `close()` was called. Read only.",
              "name": "closingAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when `close()` was called. Read only."
            },
            {
              "textRaw": "Type: {bigint} A timestamp indicating when the DTLS handshake completed. Read only.",
              "name": "handshakeCompletedAt",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "A timestamp indicating when the DTLS handshake completed. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of application data bytes received. Read only.",
              "name": "bytesReceived",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of application data bytes received. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of application data bytes sent. Read only.",
              "name": "bytesSent",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of application data bytes sent. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of application messages received. Read only.",
              "name": "messagesReceived",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of application messages received. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of application messages sent. Read only.",
              "name": "messagesSent",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of application messages sent. Read only."
            },
            {
              "textRaw": "Type: {bigint} The total number of DTLS handshake retransmissions. Read only.",
              "name": "retransmitCount",
              "type": "bigint",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "The total number of DTLS handshake retransmissions. Read only."
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "isConnected",
              "type": "boolean",
              "meta": {
                "added": [
                  "v26.9.0"
                ],
                "changes": []
              },
              "desc": "<p><code>true</code> if the stats object is still connected to the underlying session.\nOnce the session is destroyed, the stats become a stale snapshot.</p>"
            }
          ]
        }
      ],
      "displayName": "DTLS"
    }
  ]
}