diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-06 18:50:08 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-06 18:50:08 -0500 |
commit | b1fb410affb7bcd2e714abac01d22c4a5332c344 (patch) | |
tree | 7ebb621ab9b73e3e1fbaeb0ef8c19abef95b7c9f /src/dns/packet/query.rs | |
parent | finialize initial dns + caching (diff) | |
download | wrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.tar.gz wrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.tar.bz2 wrapper-b1fb410affb7bcd2e714abac01d22c4a5332c344.zip |
finish dns and start webserver
Diffstat (limited to '')
-rw-r--r-- | src/dns/packet/query.rs (renamed from src/packet/query.rs) | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/packet/query.rs b/src/dns/packet/query.rs index cae6f09..732b9b2 100644 --- a/src/packet/query.rs +++ b/src/dns/packet/query.rs @@ -12,6 +12,8 @@ pub enum QueryType { SRV, // 33 OPT, // 41 CAA, // 257 + AR, // 1000 + AAAAR, // 1001 } impl QueryType { @@ -29,6 +31,8 @@ impl QueryType { Self::SRV => 33, Self::OPT => 41, Self::CAA => 257, + Self::AR => 1000, + Self::AAAAR => 1001, } } @@ -45,7 +49,30 @@ impl QueryType { 33 => Self::SRV, 41 => Self::OPT, 257 => Self::CAA, + 1000 => Self::AR, + 1001 => Self::AAAAR, _ => Self::UNKNOWN(num), } } + + pub fn allowed_actions(&self) -> (bool, bool) { + // 0. duplicates allowed + // 1. allowed to be created by database + match self { + QueryType::UNKNOWN(_) => (false, false), + QueryType::A => (true, true), + QueryType::NS => (false, true), + QueryType::CNAME => (false, true), + QueryType::SOA => (false, false), + QueryType::PTR => (false, true), + QueryType::MX => (false, true), + QueryType::TXT => (true, true), + QueryType::AAAA => (true, true), + QueryType::SRV => (false, true), + QueryType::OPT => (false, false), + QueryType::CAA => (false, true), + QueryType::AR => (false, true), + QueryType::AAAAR => (false, true), + } + } } |