summaryrefslogtreecommitdiff
path: root/ext/net/ops.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/net/ops.rs')
-rw-r--r--ext/net/ops.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/net/ops.rs b/ext/net/ops.rs
index 0167448dd..4fef38985 100644
--- a/ext/net/ops.rs
+++ b/ext/net/ops.rs
@@ -579,6 +579,7 @@ pub enum DnsReturnRecord {
preference: u16,
exchange: String,
},
+ Ns(String),
Ptr(String),
Srv {
priority: u16,
@@ -730,6 +731,7 @@ fn rdata_to_return_record(
preference: mx.preference(),
exchange: mx.exchange().to_string(),
}),
+ NS => r.as_ns().map(ToString::to_string).map(DnsReturnRecord::Ns),
PTR => r
.as_ptr()
.map(ToString::to_string)
@@ -818,6 +820,13 @@ mod tests {
}
#[test]
+ fn rdata_to_return_record_ns() {
+ let func = rdata_to_return_record(RecordType::NS);
+ let rdata = RData::NS(Name::new());
+ assert_eq!(func(&rdata), Some(DnsReturnRecord::Ns("".to_string())));
+ }
+
+ #[test]
fn rdata_to_return_record_ptr() {
let func = rdata_to_return_record(RecordType::PTR);
let rdata = RData::PTR(Name::new());