dns_message_parser/rr/rfc_3596.rs
1use crate::DomainName;
2use std::fmt::{Display, Formatter, Result as FmtResult};
3use std::net::Ipv6Addr;
4
5/// The [IPv6] [host address] resource record type.
6///
7/// [IPv6]: https://tools.ietf.org/html/rfc2460
8/// [host address]: https://tools.ietf.org/html/rfc3596#section-2
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct AAAA {
11 pub domain_name: DomainName,
12 pub ttl: u32,
13 pub ipv6_addr: Ipv6Addr,
14}
15
16impl_to_type!(AAAA);
17
18impl Display for AAAA {
19 fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
20 write!(
21 f,
22 "{} {} IN AAAA {}",
23 self.domain_name, self.ttl, self.ipv6_addr,
24 )
25 }
26}