aboutsummaryrefslogtreecommitdiffstats
path: root/src/router/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/router/types.rs')
-rw-r--r--src/router/types.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/router/types.rs b/src/router/types.rs
index 82dcd09..5077686 100644
--- a/src/router/types.rs
+++ b/src/router/types.rs
@@ -1,4 +1,6 @@
+use std::fmt;
use std::marker::PhantomData;
+use std::error::Error;
pub trait Opaque: Send + Sync + 'static {}
@@ -49,3 +51,30 @@ impl<O: Opaque, R: Callback<O>, S: Callback<O>, K: KeyCallback<O>> Callbacks
type CallbackSend = S;
type CallbackKey = K;
}
+
+
+
+#[derive(Debug)]
+pub enum RouterError {
+ NoCryptKeyRoute,
+ MalformedIPHeader,
+}
+
+impl fmt::Display for RouterError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ RouterError::NoCryptKeyRoute => write!(f, "No cryptkey route configured for subnet"),
+ RouterError::MalformedIPHeader => write!(f, "IP header is malformed")
+ }
+ }
+}
+
+impl Error for RouterError {
+ fn description(&self) -> &str {
+ "Generic Handshake Error"
+ }
+
+ fn source(&self) -> Option<&(dyn Error + 'static)> {
+ None
+ }
+} \ No newline at end of file