3.2.0
RFC 8489 (STUN 2020) support:
- New attributes:
MESSAGE_INTEGRITY_SHA256(0x001C),PASSWORD_ALGORITHM(0x001D),USERHASH(0x001E),PASSWORD_ALGORITHMS(0x8002),ALTERNATE_DOMAIN(0x8003) addMessageIntegritySha256(key)onStunRequestaddUserhash(username, realm)— sends SHA-256(username:realm) instead of plaintext usernameaddPasswordAlgorithm(algorithm, params?)— single algorithm selectionaddPasswordAlgorithms(algorithms)— server-side algorithm advertisementaddAlternateDomain(domain)— FQDN companion toALTERNATE_SERVER- Corresponding getters on
StunResponse:getMessageIntegritySha256(),getUserhash(),getPasswordAlgorithm(),getPasswordAlgorithms(),getAlternateDomain() validateMessageIntegritySha256(message, key)exported fromlib/validateand from the top-level moduleconstants.passwordAlgorithm({ MD5: 0x0001, SHA_256: 0x0002 }) and public constants prefixedSTUN_PASSWORD_ALGORITHM_- Custom codec classes
StunPasswordAlgorithmAttributeandStunPasswordAlgorithmsAttributewith correct per-entry padding for the list format
RFC 7064 (stuns: URI scheme) support:
request('stuns://host:port')routes to a new TLS-over-TCP transport (tls-request)- default port for
stuns:is 5349 (was previously an error) rejectUnauthorizedoption forwarded to the TLS socket (defaultstrue)http:and other non-STUN protocols still throwInvalid protocol
Modern JS idioms
- index — constants export rewritten using
Object.fromEntries & assign+ a smallprefix()helper, replacing fiveObject.keys().forEach()mutation loops util— removed redundant!Number.isNaN(m)fromisNumber()create-message—||→transaction ?? createTransaction()(nullish coalescing)