summaryrefslogtreecommitdiff
path: root/src/packet/result.rs
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-03-03 00:10:21 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-03-03 00:10:21 -0500
commit0f40ab89e3b523ac206077d932a0e2d40d75f7e0 (patch)
treec4914050d1bbca8af77347220c0785c8ebefa213 /src/packet/result.rs
parentclippy my beloved (diff)
downloadwrapper-0f40ab89e3b523ac206077d932a0e2d40d75f7e0.tar.gz
wrapper-0f40ab89e3b523ac206077d932a0e2d40d75f7e0.tar.bz2
wrapper-0f40ab89e3b523ac206077d932a0e2d40d75f7e0.zip
finialize initial dns + caching
Diffstat (limited to 'src/packet/result.rs')
-rw-r--r--src/packet/result.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/packet/result.rs b/src/packet/result.rs
new file mode 100644
index 0000000..41c8ba9
--- /dev/null
+++ b/src/packet/result.rs
@@ -0,0 +1,22 @@
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub enum ResultCode {
+ NOERROR = 0,
+ FORMERR = 1,
+ SERVFAIL = 2,
+ NXDOMAIN = 3,
+ NOTIMP = 4,
+ REFUSED = 5,
+}
+
+impl ResultCode {
+ pub fn from_num(num: u8) -> Self {
+ match num {
+ 1 => Self::FORMERR,
+ 2 => Self::SERVFAIL,
+ 3 => Self::NXDOMAIN,
+ 4 => Self::NOTIMP,
+ 5 => Self::REFUSED,
+ 0 | _ => Self::NOERROR,
+ }
+ }
+}