mirror of
https://github.com/edera-dev/krata.git
synced 2025-10-10 21:19:38 +00:00
hypha: work in progress implementation of outbound internet access
This commit is contained in:
30
libs/ipstack/src/error.rs
Normal file
30
libs/ipstack/src/error.rs
Normal file
@ -0,0 +1,30 @@
|
||||
#[allow(dead_code)]
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum IpStackError {
|
||||
#[error("The transport protocol is not supported")]
|
||||
UnsupportedTransportProtocol,
|
||||
#[error("The packet is invalid")]
|
||||
InvalidPacket,
|
||||
#[error("Write error: {0}")]
|
||||
PacketWriteError(etherparse::WriteError),
|
||||
#[error("Invalid Tcp packet")]
|
||||
InvalidTcpPacket,
|
||||
#[error("IO error: {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
#[error("Accept Error")]
|
||||
AcceptError,
|
||||
|
||||
#[error("Send Error {0}")]
|
||||
SendError(#[from] tokio::sync::mpsc::error::SendError<crate::stream::IpStackStream>),
|
||||
}
|
||||
|
||||
impl From<IpStackError> for std::io::Error {
|
||||
fn from(e: IpStackError) -> Self {
|
||||
match e {
|
||||
IpStackError::IoError(e) => e,
|
||||
_ => std::io::Error::new(std::io::ErrorKind::Other, e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type Result<T, E = IpStackError> = std::result::Result<T, E>;
|
Reference in New Issue
Block a user