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::*;
use crate::error::Result;
use crate::message::name::*;
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct NsResource {
pub ns: Name,
}
impl fmt::Display for NsResource {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "dnsmessage.NSResource{{NS: {}}}", self.ns)
}
}
impl ResourceBody for NsResource {
fn real_type(&self) -> DnsType {
DnsType::Ns
}
fn pack(
&self,
msg: Vec<u8>,
compression: &mut Option<HashMap<String, usize>>,
compression_off: usize,
) -> Result<Vec<u8>> {
self.ns.pack(msg, compression, compression_off)
}
fn unpack(&mut self, msg: &[u8], off: usize, _txt_length: usize) -> Result<usize> {
self.ns.unpack(msg, off)
}
}