pub enum DnsRData {
Show 26 variants
A(Ipv4Addr),
AAAA(Ipv6Addr),
NS(DnsName),
CNAME(DnsName),
PTR(DnsName),
DNAME(DnsName),
MX {
preference: u16,
exchange: DnsName,
},
TXT(Vec<Vec<u8>>),
SOA {
mname: DnsName,
rname: DnsName,
serial: u32,
refresh: u32,
retry: u32,
expire: u32,
minimum: u32,
},
SRV {
priority: u16,
weight: u16,
port: u16,
target: DnsName,
},
HINFO {
cpu: Vec<u8>,
os: Vec<u8>,
},
NAPTR {
order: u16,
preference: u16,
flags: Vec<u8>,
services: Vec<u8>,
regexp: Vec<u8>,
replacement: DnsName,
},
SVCB {
priority: u16,
target: DnsName,
params: Vec<SvcParam>,
},
HTTPS {
priority: u16,
target: DnsName,
params: Vec<SvcParam>,
},
CAA {
flags: u8,
tag: String,
value: Vec<u8>,
},
RRSIG {
type_covered: u16,
algorithm: u8,
labels: u8,
original_ttl: u32,
sig_expiration: u32,
sig_inception: u32,
key_tag: u16,
signer_name: DnsName,
signature: Vec<u8>,
},
NSEC {
next_domain: DnsName,
type_bitmaps: Vec<u16>,
},
NSEC3 {
hash_algorithm: u8,
flags: u8,
iterations: u16,
salt: Vec<u8>,
next_hashed: Vec<u8>,
type_bitmaps: Vec<u16>,
},
NSEC3PARAM {
hash_algorithm: u8,
flags: u8,
iterations: u16,
salt: Vec<u8>,
},
DNSKEY {
flags: u16,
protocol: u8,
algorithm: u8,
public_key: Vec<u8>,
},
DS {
key_tag: u16,
algorithm: u8,
digest_type: u8,
digest: Vec<u8>,
},
DLV {
key_tag: u16,
algorithm: u8,
digest_type: u8,
digest: Vec<u8>,
},
TSIG {
algorithm_name: DnsName,
time_signed: u64,
fudge: u16,
mac: Vec<u8>,
original_id: u16,
error: u16,
other_data: Vec<u8>,
},
TLSA {
usage: u8,
selector: u8,
matching_type: u8,
cert_data: Vec<u8>,
},
OPT(Vec<EdnsOption>),
Unknown {
rtype: u16,
data: Vec<u8>,
},
}Expand description
Parsed DNS resource record data.
Each variant corresponds to one or more DNS RR types and contains the fully parsed fields of that record’s RDATA section.
Variants§
A(Ipv4Addr)
A record: IPv4 address (RFC 1035).
AAAA(Ipv6Addr)
AAAA record: IPv6 address (RFC 3596).
NS(DnsName)
NS record: authoritative name server (RFC 1035).
CNAME(DnsName)
CNAME record: canonical name alias (RFC 1035).
PTR(DnsName)
PTR record: pointer to a domain name (RFC 1035).
DNAME(DnsName)
DNAME record: delegation of a subtree (RFC 6672).
MX
MX record: mail exchange (RFC 1035).
TXT(Vec<Vec<u8>>)
TXT record: text strings (RFC 1035). Contains multiple character-strings, each up to 255 bytes.
SOA
SOA record: start of authority (RFC 1035).
SRV
SRV record: service location (RFC 2782).
HINFO
HINFO record: host information (RFC 1035).
NAPTR
NAPTR record: naming authority pointer (RFC 3403).
Fields
SVCB
SVCB record: service binding (RFC 9460).
HTTPS
HTTPS record: HTTPS service binding (RFC 9460).
CAA
CAA record: certificate authority authorization (RFC 8659).
RRSIG
RRSIG record: DNSSEC signature (RFC 4034).
Fields
NSEC
NSEC record: authenticated denial of existence (RFC 4034).
NSEC3
NSEC3 record: hashed authenticated denial of existence (RFC 5155).
Fields
NSEC3PARAM
NSEC3PARAM record: NSEC3 parameters (RFC 5155).
DNSKEY
DNSKEY record: DNSSEC public key (RFC 4034).
DS
DS record: delegation signer (RFC 4034).
DLV
DLV record: DNSSEC lookaside validation (RFC 4431).
TSIG
TSIG record: transaction signature (RFC 8945).
Fields
TLSA
TLSA record: TLS authentication (RFC 6698).
OPT(Vec<EdnsOption>)
OPT pseudo-record: EDNS(0) options (RFC 6891).
Unknown
Unknown/unsupported record type.
Implementations§
Source§impl DnsRData
impl DnsRData
Sourcepub fn parse(
rtype: u16,
packet: &[u8],
rdata_offset: usize,
rdlength: u16,
) -> Result<Self, FieldError>
pub fn parse( rtype: u16, packet: &[u8], rdata_offset: usize, rdlength: u16, ) -> Result<Self, FieldError>
Parse RDATA from wire format.
§Arguments
rtype- DNS record type numberpacket- Full DNS packet buffer (needed for name compression pointer resolution)rdata_offset- Byte offset where RDATA begins inpacketrdlength- Length of RDATA in bytes
Sourcepub fn build_compressed(
&self,
offset: usize,
map: &mut HashMap<String, u16>,
) -> Vec<u8> ⓘ
pub fn build_compressed( &self, offset: usize, map: &mut HashMap<String, u16>, ) -> Vec<u8> ⓘ
Serialize RDATA to wire format with DNS name compression.
§Arguments
offset- Byte offset where this RDATA will be placed in the packet. Used to record name positions in the compression map.map- Compression map tracking previously written domain names and their offsets.