feat: added beacon installer generation, download

This commit is contained in:
Andrew Rioux
2025-02-02 02:37:53 -05:00
parent b416f35b63
commit 0576c4fd3b
22 changed files with 554 additions and 87 deletions
+22
View File
@@ -10,6 +10,7 @@ pub enum Error {
Pbkdf2(pbkdf2::password_hash::errors::Error),
#[cfg(feature = "ssr")]
Io(std::io::Error),
AddrParse(std::net::AddrParseError),
}
impl std::fmt::Display for Error {
@@ -37,6 +38,9 @@ impl std::fmt::Display for Error {
Error::Io(err) => {
write!(f, "io error: {err:?}")
}
Error::AddrParse(err) => {
write!(f, "ip address parse error: {err:?}")
}
}
}
}
@@ -50,11 +54,23 @@ impl std::error::Error for Error {
Error::TokioJoin(err) => Some(err),
#[cfg(feature = "ssr")]
Error::Io(err) => Some(err),
Error::AddrParse(err) => Some(err),
_ => None,
}
}
}
#[cfg(feature = "ssr")]
impl axum::response::IntoResponse for Error {
fn into_response(self) -> axum::response::Response {
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
format!("{:?}", self),
)
.into_response()
}
}
impl std::str::FromStr for Error {
type Err = Self;
@@ -90,3 +106,9 @@ impl From<std::io::Error> for Error {
Self::Io(err)
}
}
impl From<std::net::AddrParseError> for Error {
fn from(err: std::net::AddrParseError) -> Self {
Self::AddrParse(err)
}
}