aboutsummaryrefslogtreecommitdiffstats
path: root/src/types.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-18 19:52:23 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-18 19:52:23 +0200
commite0e95d9679e4cb0eb905d9f0910a49fe86586982 (patch)
tree290fe613430ea4a30fa7ee947cf95d0dbab0ccab /src/types.rs
parentBegin processing of initation (diff)
downloadwireguard-rs-e0e95d9679e4cb0eb905d9f0910a49fe86586982.tar.xz
wireguard-rs-e0e95d9679e4cb0eb905d9f0910a49fe86586982.zip
Begin creation of response
Diffstat (limited to '')
-rw-r--r--src/types.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/types.rs b/src/types.rs
index 464ad81..a2a7cdd 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,11 +1,6 @@
use std::fmt;
use std::error::Error;
-use x25519_dalek::PublicKey;
-use x25519_dalek::SharedSecret;
-
-use crate::timestamp;
-
// config error
#[derive(Debug)]
@@ -45,7 +40,16 @@ pub enum HandshakeError {
impl fmt::Display for HandshakeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "HandshakeError")
+ match self {
+ HandshakeError::DecryptionFailure =>
+ write!(f, "Failed to AEAD:OPEN"),
+ HandshakeError::UnknownPublicKey =>
+ write!(f, "Unknown public key"),
+ HandshakeError::InvalidMessageFormat =>
+ write!(f, "Invalid handshake message format"),
+ HandshakeError::OldTimestamp =>
+ write!(f, "Timestamp is less/equal to the newest")
+ }
}
}