Additional documentation

This commit is contained in:
Benjamin Saunders
2018-04-11 23:25:00 -07:00
parent 9ccb503b91
commit 1c460de39b
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -109,6 +109,7 @@ impl Default for Config {
}}
}
/// The main entry point to the library
pub struct Endpoint {
log: Logger,
rng: OsRng,
@@ -143,9 +144,20 @@ fn reset_token_for(key: &[u8], id: &ConnectionId) -> [u8; 16] {
result
}
/// Information that should be preserved between restarts
///
/// Keeping this around allows better behavior by clients that communicated with a previous instance of the same
/// endpoint.
#[derive(Copy, Clone)]
pub struct PersistentState {
/// Cryptographic key used to ensure integrity of data included in handshake cookies.
///
/// Initialize with random bytes.
pub cookie_key: [u8; 64],
/// Cryptographic key used to send authenticated connection resets to clients who were communicating with a previous
/// instance of tihs endpoint.
///
/// Initialize with random bytes.
pub reset_key: [u8; 64],
}
+1 -1
View File
@@ -11,7 +11,7 @@ impl From<Error> for u16 { fn from(x: Error) -> u16 { x.0 } }
macro_rules! errors {
{$($name:ident($val:expr) $desc:expr;)*} => {
impl Error {
$(pub const $name: Self = Error($val);)*
$(#[doc = $desc] pub const $name: Self = Error($val);)*
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {