dns.wire.writer

dns.wire

writer() -> writer

Create a new wire format writer

Returns a builder-based writer that accumulates bytes into an internal table. Provides methods for writing DNS wire format primitives (u8, u16, u32, bytes), compressed names, and character-strings. Use output() to get the accumulated bytes as a string. Use patch_u16(offset, val) for header fixups.

The writer maintains a compression table for name compression: when writing the same domain name suffix twice, the second occurrence is replaced with a 2-byte pointer.