mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-01 04:12:13 +00:00
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
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:
parent
3dc8f222cb
commit
6a5692cea0
2 changed files with 18 additions and 12 deletions
20
Cargo.toml
20
Cargo.toml
|
@ -55,18 +55,17 @@ udp-stream = { version = "0.0.12", default-features = false }
|
||||||
unicase = "2"
|
unicase = "2"
|
||||||
url = "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]
|
[target.'cfg(target_os="android")'.dependencies]
|
||||||
android_logger = "0.15"
|
android_logger = "0.15"
|
||||||
jni = { version = "0.21", default-features = false }
|
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]
|
[target.'cfg(unix)'.dependencies]
|
||||||
daemonize = "0.5"
|
daemonize = "0.5"
|
||||||
nix = { version = "0.30", default-features = false, features = [
|
nix = { version = "0.30", default-features = false, features = [
|
||||||
|
@ -75,8 +74,9 @@ nix = { version = "0.30", default-features = false, features = [
|
||||||
"uio",
|
"uio",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[build-dependencies]
|
||||||
windows-service = "0.8"
|
chrono = "0.4"
|
||||||
|
serde_json = "1"
|
||||||
|
|
||||||
# [profile.release]
|
# [profile.release]
|
||||||
# strip = "symbols"
|
# strip = "symbols"
|
||||||
|
|
10
src/error.rs
10
src/error.rs
|
@ -23,7 +23,7 @@ pub enum Error {
|
||||||
TryFromSlice(#[from] std::array::TryFromSliceError),
|
TryFromSlice(#[from] std::array::TryFromSliceError),
|
||||||
|
|
||||||
#[error("IpStackError {0:?}")]
|
#[error("IpStackError {0:?}")]
|
||||||
IpStack(#[from] ipstack::IpStackError),
|
IpStack(#[from] Box<ipstack::IpStackError>),
|
||||||
|
|
||||||
#[error("DnsProtoError {0:?}")]
|
#[error("DnsProtoError {0:?}")]
|
||||||
DnsProto(#[from] hickory_proto::ProtoError),
|
DnsProto(#[from] hickory_proto::ProtoError),
|
||||||
|
@ -45,6 +45,12 @@ pub enum Error {
|
||||||
IntParseError(#[from] std::num::ParseIntError),
|
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 {
|
impl From<&str> for Error {
|
||||||
fn from(err: &str) -> Self {
|
fn from(err: &str) -> Self {
|
||||||
Self::String(err.to_string())
|
Self::String(err.to_string())
|
||||||
|
@ -67,7 +73,7 @@ impl From<Error> for std::io::Error {
|
||||||
fn from(err: Error) -> Self {
|
fn from(err: Error) -> Self {
|
||||||
match err {
|
match err {
|
||||||
Error::Io(err) => err,
|
Error::Io(err) => err,
|
||||||
_ => std::io::Error::new(std::io::ErrorKind::Other, err),
|
_ => std::io::Error::other(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue