adding txt rdata
This commit is contained in:
parent
bda56b4084
commit
fdc8a7e338
@ -16,7 +16,7 @@ impl Debug for ARdata {
|
|||||||
|
|
||||||
impl RData for ARdata {
|
impl RData for ARdata {
|
||||||
fn to_bytes(&self) -> Vec<u8> {
|
fn to_bytes(&self) -> Vec<u8> {
|
||||||
return self.rdata.octets().to_vec();
|
self.rdata.octets().to_vec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ impl Debug for AAAARdata {
|
|||||||
|
|
||||||
impl RData for AAAARdata {
|
impl RData for AAAARdata {
|
||||||
fn to_bytes(&self) -> Vec<u8> {
|
fn to_bytes(&self) -> Vec<u8> {
|
||||||
return self.rdata.octets().to_vec();
|
self.rdata.octets().to_vec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ pub use a_rdata::ARdata;
|
|||||||
mod aaaa_rdata;
|
mod aaaa_rdata;
|
||||||
pub use aaaa_rdata::AAAARdata;
|
pub use aaaa_rdata::AAAARdata;
|
||||||
|
|
||||||
|
mod txt_rdata;
|
||||||
|
pub use txt_rdata::TXTRdata;
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -15,7 +15,7 @@ impl Debug for RawRData {
|
|||||||
|
|
||||||
impl RData for RawRData {
|
impl RData for RawRData {
|
||||||
fn to_bytes(&self) -> Vec<u8> {
|
fn to_bytes(&self) -> Vec<u8> {
|
||||||
return self.rdata.clone();
|
self.rdata.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
dnstp/src/message/answer/txt_rdata.rs
Normal file
29
dnstp/src/message/answer/txt_rdata.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
use std::fmt::{Debug, Formatter};
|
||||||
|
use crate::message::answer::RData;
|
||||||
|
|
||||||
|
pub struct TXTRdata {
|
||||||
|
pub rdata: String
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Debug for TXTRdata {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.debug_struct("TXT")
|
||||||
|
.field("data", &self.rdata)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RData for TXTRdata {
|
||||||
|
fn to_bytes(&self) -> Vec<u8> {
|
||||||
|
self.rdata.into_bytes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TXTRdata {
|
||||||
|
pub fn from(rdata: String) -> TXTRdata
|
||||||
|
{
|
||||||
|
TXTRdata {
|
||||||
|
rdata
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ pub mod answer;
|
|||||||
pub mod response;
|
pub mod response;
|
||||||
|
|
||||||
pub use question::{DNSQuestion, QClass, QType, QuestionParseError, questions_to_bytes, questions_from_bytes};
|
pub use question::{DNSQuestion, QClass, QType, QuestionParseError, questions_to_bytes, questions_from_bytes};
|
||||||
pub use answer::{ResourceRecord, RawRData, RData, ARdata, AAAARdata, RecordParseError, records_to_bytes, answers_from_bytes};
|
pub use answer::{ResourceRecord, RawRData, RData, ARdata, AAAARdata, TXTRdata, RecordParseError, records_to_bytes, answers_from_bytes};
|
||||||
pub use header::{DNSHeader, Direction, Opcode, ResponseCode, HEADER_SIZE};
|
pub use header::{DNSHeader, Direction, Opcode, ResponseCode, HEADER_SIZE};
|
||||||
pub use request::DNSRequest;
|
pub use request::DNSRequest;
|
||||||
pub use response::DNSResponse;
|
pub use response::DNSResponse;
|
Loading…
Reference in New Issue
Block a user