dns_message_parser/rr/
rfc_2782.rs

1use super::Class;
2use crate::DomainName;
3use std::fmt::{Display, Formatter, Result as FmtResult};
4
5/// The [location of services] resource record type.
6///
7/// [location of services]: https://tools.ietf.org/html/rfc2782
8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct SRV {
10    pub domain_name: DomainName,
11    pub ttl: u32,
12    pub class: Class,
13    pub priority: u16,
14    pub weight: u16,
15    pub port: u16,
16    pub target: DomainName,
17}
18
19impl_to_type!(SRV);
20
21impl Display for SRV {
22    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
23        write!(
24            f,
25            "{} {} {} SRV {} {} {} {}",
26            self.domain_name,
27            self.ttl,
28            self.class,
29            self.priority,
30            self.weight,
31            self.port,
32            self.target
33        )
34    }
35}