refine code
Some checks failed
Push or PR / Check semver (push) Has been cancelled
Push or PR / build_n_test (macos-latest) (push) Has been cancelled
Push or PR / build_n_test (ubuntu-latest) (push) Has been cancelled
Push or PR / build_n_test (windows-latest) (push) Has been cancelled
Push or PR / build_n_test_android (push) Has been cancelled
Push or PR / build_n_test_ios (push) Has been cancelled
Integration Tests / Proxy Tests (push) Has been cancelled

This commit is contained in:
ssrlive 2025-05-21 15:19:18 +08:00
parent 3dc8f222cb
commit 6a5692cea0
2 changed files with 18 additions and 12 deletions

View file

@ -55,18 +55,17 @@ udp-stream = { version = "0.0.12", default-features = false }
unicase = "2"
url = "2"
[build-dependencies]
chrono = "0.4"
serde_json = "1"
[target.'cfg(target_os="linux")'.dependencies]
serde = { version = "1", features = ["derive"] }
bincode = "2"
[target.'cfg(target_os="android")'.dependencies]
android_logger = "0.15"
jni = { version = "0.21", default-features = false }
[target.'cfg(target_os="linux")'.dependencies]
bincode = "2"
serde = { version = "1", features = ["derive"] }
[target.'cfg(target_os="windows")'.dependencies]
windows-service = "0.8"
[target.'cfg(unix)'.dependencies]
daemonize = "0.5"
nix = { version = "0.30", default-features = false, features = [
@ -75,8 +74,9 @@ nix = { version = "0.30", default-features = false, features = [
"uio",
] }
[target.'cfg(target_os = "windows")'.dependencies]
windows-service = "0.8"
[build-dependencies]
chrono = "0.4"
serde_json = "1"
# [profile.release]
# strip = "symbols"

View file

@ -23,7 +23,7 @@ pub enum Error {
TryFromSlice(#[from] std::array::TryFromSliceError),
#[error("IpStackError {0:?}")]
IpStack(#[from] ipstack::IpStackError),
IpStack(#[from] Box<ipstack::IpStackError>),
#[error("DnsProtoError {0:?}")]
DnsProto(#[from] hickory_proto::ProtoError),
@ -45,6 +45,12 @@ pub enum Error {
IntParseError(#[from] std::num::ParseIntError),
}
impl From<ipstack::IpStackError> for Error {
fn from(err: ipstack::IpStackError) -> Self {
Self::IpStack(Box::new(err))
}
}
impl From<&str> for Error {
fn from(err: &str) -> Self {
Self::String(err.to_string())
@ -67,7 +73,7 @@ impl From<Error> for std::io::Error {
fn from(err: Error) -> Self {
match err {
Error::Io(err) => err,
_ => std::io::Error::new(std::io::ErrorKind::Other, err),
_ => std::io::Error::other(err),
}
}
}