diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-09-10 21:42:21 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-09-10 21:42:21 +0200 |
commit | 02d9bdcc96c955b654a45d3629b1ee515902078d (patch) | |
tree | d0231989ccca424d26f0dcded640acac079aa9de /src/router/types.rs | |
parent | Begin work on full router interaction unittest (diff) | |
download | wireguard-rs-02d9bdcc96c955b654a45d3629b1ee515902078d.tar.xz wireguard-rs-02d9bdcc96c955b654a45d3629b1ee515902078d.zip |
Full inbound/outbound router test
Diffstat (limited to 'src/router/types.rs')
-rw-r--r-- | src/router/types.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/router/types.rs b/src/router/types.rs index 7706997..61f1fe7 100644 --- a/src/router/types.rs +++ b/src/router/types.rs @@ -11,9 +11,9 @@ impl<T> Opaque for T where T: Send + Sync + 'static {} /// * `0`, a reference to the opaque value assigned to the peer /// * `1`, a bool indicating whether the message contained data (not just keepalive) /// * `2`, a bool indicating whether the message was transmitted (i.e. did the peer have an associated endpoint?) -pub trait Callback<T>: Fn(&T, bool, bool) -> () + Sync + Send + 'static {} +pub trait Callback<T>: Fn(&T, usize, bool, bool) -> () + Sync + Send + 'static {} -impl<T, F> Callback<T> for F where F: Fn(&T, bool, bool) -> () + Sync + Send + 'static {} +impl<T, F> Callback<T> for F where F: Fn(&T, usize, bool, bool) -> () + Sync + Send + 'static {} /// A key callback takes 1 argument /// @@ -58,6 +58,8 @@ pub enum RouterError { MalformedIPHeader, MalformedTransportMessage, UnkownReceiverId, + NoEndpoint, + SendError, } impl fmt::Display for RouterError { @@ -69,6 +71,8 @@ impl fmt::Display for RouterError { RouterError::UnkownReceiverId => { write!(f, "No decryption state associated with receiver id") } + RouterError::NoEndpoint => write!(f, "No endpoint for peer"), + RouterError::SendError => write!(f, "Failed to send packet on bind"), } } } |