extractClientHelloCookie

fnconst(ubyte)[] extractClientHelloCookie(const(ubyte)[] clientHelloBody) @safe pure nothrow

Extracts the cookie from a DTLS ClientHello message.

In DTLS, the ClientHello includes a cookie field after the session ID. On the first attempt the cookie is empty; after receiving a HelloVerifyRequest the client echoes the cookie back.

Parameters

clientHelloBodyThe ClientHello body bytes (after DTLS handshake header).

Returns

The cookie bytes, or an empty slice if no cookie is present.