diff options
author | Jake McGinty <me@jake.su> | 2018-05-06 18:57:52 -0700 |
---|---|---|
committer | Jake McGinty <me@jake.su> | 2018-05-06 18:57:52 -0700 |
commit | f514e9f50c685cf46c7c5055a1eba3e40c165f39 (patch) | |
tree | 57500866abf2e41a7476a03e4e90c176c4f468b6 /src/message.rs | |
parent | peer_server: hold on to single local csprng instance for performance (diff) | |
download | wireguard-rs-f514e9f50c685cf46c7c5055a1eba3e40c165f39.tar.xz wireguard-rs-f514e9f50c685cf46c7c5055a1eba3e40c165f39.zip |
global: small aesthetic cleanup
Diffstat (limited to 'src/message.rs')
-rw-r--r-- | src/message.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/message.rs b/src/message.rs index 32445f6..4dd2fa8 100644 --- a/src/message.rs +++ b/src/message.rs @@ -4,6 +4,11 @@ use failure::Error; use std::convert::{TryFrom, TryInto}; use byteorder::{ByteOrder, LittleEndian}; +#[derive(Deref)] pub struct Initiation(Vec<u8>); +#[derive(Deref)] pub struct Response(Vec<u8>); +#[derive(Deref)] pub struct CookieReply(Vec<u8>); +#[derive(Deref)] pub struct Transport(Vec<u8>); + pub enum Message { Initiation(Initiation), Response(Response), @@ -25,9 +30,6 @@ impl TryFrom<Vec<u8>> for Message { } } -#[derive(Deref)] -pub struct Initiation(Vec<u8>); - impl Initiation { pub fn their_index(&self) -> u32 { LittleEndian::read_u32(&self[4..]) @@ -51,9 +53,6 @@ impl TryFrom<Vec<u8>> for Initiation { } } -#[derive(Deref)] -pub struct Response(Vec<u8>); - impl Response { pub fn their_index(&self) -> u32 { LittleEndian::read_u32(&self[4..]) @@ -89,9 +88,6 @@ impl TryFrom<Vec<u8>> for Response { } } -#[derive(Deref)] -pub struct CookieReply(Vec<u8>); - impl CookieReply { pub fn our_index(&self) -> u32 { LittleEndian::read_u32(&self[4..]) @@ -123,9 +119,6 @@ impl TryFrom<Vec<u8>> for CookieReply { } } -#[derive(Deref)] -pub struct Transport(Vec<u8>); - impl Transport { pub fn our_index(&self) -> u32 { LittleEndian::read_u32(&self[4..]) |