[−]Enum ossuary::OssuaryError
Error produced by Ossuary or one of its dependencies
The most important errors that all programs must explicitly consider are:
Variants
Io(String)
A problem with I/O read or writes.
An Io error is most likely raised when using an input or output buffer
that is more complex than a simple in-memory buffer, such as a
std::net::TcpStream
WouldBlock(usize)
A buffer cannot complete a read/write without blocking.
Ossuary is inherently a non-blocking library, and returns this error any time it is unable to read or write more data.
When using a buffer configured for non-blocking operation, such as a
std::net::TcpStream
, any non-blocking errors
(std::io::ErrorKind::WouldBlock
) encounted by the buffer are raised
as this error.
The error has a paired parameter indicating whether any data WAS read or written (depending on the function called). This can be non-zero on operations that require multiple consecutive read/write operations to the buffer if some but not all operations succeeded.
When using an input or output buffer in a manner that requires manually sending or clearing data from the buffer, such as when passing the data from Ossuary through an in-memory buffer prior to handing it to a TCP connection, the amount of bytes indicated by the paired parameter should be processed immediately.
UntrustedServer(Vec<u8>)
Connection accepted by an unknown/untrusted server.
Returned when, during the handshake process, the server correctly verifies itself, but its public key is not specified as an authorized key. The caller may use this to implement a Trust-On-First-Use (TOFU) policy.
This error contains the public key of the remote server.
After this is returned, the handshake process is paused until the caller
verifies that the key is to be trusted by calling add_authorized_keys
with the returned public key. This should only be done if the user has
opted for a TOFU policy, and this is the first time connecting to this
remote host.
It is the caller's responsibility to save a database of (host, key) pairs when implementing TOFU.
Unpack(String)
Error casting received bytes to a primitive type.
This error likely indicates a sync or corruption error in the data stream, and will trigger a connection reset.
NoRandomSource
Error reading from random number generator
KeySize(usize, usize)
An invalid sized encryption key was encountered.
This error is most likely caused by an attempt to register an invalid
secret or public key in add_authorized_keys
or set_secret_key
.
Both should be 32 bytes.
InvalidKey
An error occurred when parsing or using an encryption key.
This error indicates a problem when using an encryption key. This could be because an expected key is missing, the format is incorrect, it was corrupted in memory or in transit, or the wrong key was used.
This typically indicates an internal error, and will cause the connection to reset.
DecryptionFailed
Encrypted data failed to be decrypted
InvalidPacket(String)
The channel received an unexpected or malformed packet
The associated string may describe the problem that went wrong. This might be encountered if packets are duplicated, dropped, or corrupted. It typically indicates an internal error, and the connection will reset.
InvalidStruct
Error casting a received packet to an internal struct format.
This means a packet header was not found or corrupted, and will trigger a connection reset.
InvalidSignature
The signature received from a client failed to verify.
This either indicates a key mismatch (public and secret keys are not a valid pair), corruption in the stream, or a problem during the handshake. The connection will reset.
WrongProtocolVersion(u8, u8)
Remote host running an incompatible protocol version
Parameters are (
ConnectionReset(usize)
The connection has reset, and reconnection may be possible.
Ossuary does not attempt to recover from errors encountered on the data stream. If anything has gone wrong, it resets the connection. When one side resets, it always tells the other side to reset as well.
This error indicates that whatever went wrong may have been a temporal fluke, such as momentary corruption or a sync error. Reconnection with the same context may be possible. This must be handled by returning to the handshake loop.
Includes the number of bytes consumed from the input buffer, if any, at the time of the reset.
ConnectionFailed
The connection has reset, and reconnection is not suggested.
This indicates that an error has occurred that Ossuary suspects is permanent, and that a reconnect will not succeed. Errors include failed authorization, such as a connection attempt fro a client whose public key is not authorized.
When one side fails, it attempts to trigger a failure on the other side as well.
ConnectionClosed
The connection has been closed by request.
This indicates that the connection has been permanently closed by
the local side's request, and not because of an error. A call to
disconnect
triggers this.
Trait Implementations
impl Clone for OssuaryError
fn clone(&self) -> OssuaryError
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<OssuaryError> for OssuaryError
fn eq(&self, other: &OssuaryError) -> bool
fn ne(&self, other: &OssuaryError) -> bool
impl From<Error> for OssuaryError
impl From<TryFromSliceError> for OssuaryError
fn from(error: TryFromSliceError) -> Self
impl From<SignatureError> for OssuaryError
fn from(_error: SignatureError) -> Self
impl From<DecryptError> for OssuaryError
fn from(_error: DecryptError) -> Self
impl From<Error> for OssuaryError
impl Debug for OssuaryError
Auto Trait Implementations
impl Send for OssuaryError
impl Sync for OssuaryError
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self