1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use super::Class;
use crate::DomainName;
use std::fmt::{Display, Formatter, Result as FmtResult};

/// The [location of services] resource record type.
///
/// [location of services]: https://tools.ietf.org/html/rfc2782
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SRV {
    pub domain_name: DomainName,
    pub ttl: u32,
    pub class: Class,
    pub priority: u16,
    pub weight: u16,
    pub port: u16,
    pub target: DomainName,
}

impl_to_type!(SRV);

impl Display for SRV {
    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
        write!(
            f,
            "{} {} {} SRV {} {} {} {}",
            self.domain_name,
            self.ttl,
            self.class,
            self.priority,
            self.weight,
            self.port,
            self.target
        )
    }
}