use std::{
io,
net::{IpAddr, SocketAddr},
};
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("invalid network interface name `{0}`")]
InvalidInterfaceName(String),
#[error("network interface `{0}` not found")]
InterfaceNotFound(String),
#[error("network interface `{0}` has no IP address to bind to")]
NoInterfaceAddress(String),
#[error("failed to bind {addr}")]
Bind {
addr: SocketAddr,
#[source]
source: io::Error,
},
#[error("failed to join multicast group {group}")]
JoinMulticast {
group: IpAddr,
#[source]
source: io::Error,
},
#[error("service worker task failed")]
Task(#[from] tokio::task::JoinError),
#[error("all services stopped after exhausting their restart policy")]
AllServicesFailed,
#[error(transparent)]
Io(#[from] io::Error),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;