DnsPacket class

极简 DNS 报文编解码器 / A minimal DNS wire-format codec.

只覆盖诊断场景需要的部分:构造标准的 A 记录查询,解析响应头与应答段 (支持名称压缩指针、A / AAAA / CNAME 记录)/ Covers only what diagnostics need: building a standard A-record query and parsing the header plus the answer section, including name compression pointers and A / AAAA / CNAME records.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

encodeQuery(String domain, {required int id}) Uint8List
构造一个 A 记录查询报文 / Builds a standard A-record query message.
parse(Uint8List data) DnsResponse
解析 DNS 响应报文 / Parses a DNS response message.
randomId([Random? random]) int
生成一个随机的 DNS 事务 ID / Generates a random DNS transaction id.