Encodes a domain name as a sequence of length-prefixed labels ending in the zero label.
Names are encoded uncompressed (never using pointers), which is always valid on the wire. A
trailing dot is accepted and ignored; the root ("" or ".") encodes to a single zero byte.
Parameters
name: string
The dot-separated domain name.
Returns Uint8Array
The encoded name bytes.
Throws
If a label exceeds 63 octets or the whole name exceeds 255 octets.
Encodes a domain name as a sequence of length-prefixed labels ending in the zero label.
Names are encoded uncompressed (never using pointers), which is always valid on the wire. A trailing dot is accepted and ignored; the root (
""or".") encodes to a single zero byte.