Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump prost from 0.12.6 to 0.13.1 #487

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 32 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clash_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ hyper = { version = "0.14.28", features = ["http1","http2","client", "server", "
http = { version = "1.1" }
httparse = "1.9.4"
h2 = "0.4.5"
prost = "0.12"
prost = "0.13"
tower = { version = "0.4", features = ["util"] }
libc = "0.2"
foreign-types-shared = "0.3.1"
Expand Down
5 changes: 4 additions & 1 deletion clash_lib/src/app/router/rules/geodata/matcher_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ impl SuccinctMatcherGroup {
let mut set = trie::StringTrie::new();
let mut other_matchers = Vec::new();
for domain in domains {
let t = Type::try_from(domain.r#type)?;
let t = Type::try_from(domain.r#type).map_err(|x| {
crate::Error::InvalidConfig(format!("invalid domain type: {}", x))
})?;

match t {
Type::Plain | Type::Regex => {
let matcher = try_new_matcher(domain.value, t)?;
Expand Down
6 changes: 5 additions & 1 deletion clash_lib/src/app/router/rules/geodata/str_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ pub fn try_new_matcher(
) -> Result<Box<dyn Matcher>, crate::Error> {
Ok(match t {
Type::Plain => Box::new(SubStrMatcher(domain)),
Type::Regex => Box::new(RegexMatcher(regex::Regex::new(&domain)?)),
Type::Regex => {
Box::new(RegexMatcher(regex::Regex::new(&domain).map_err(|x| {
crate::Error::InvalidConfig(format!("invalid regex: {}", x))
})?))
}
Type::Domain => Box::new(DomainMatcher(domain)),
Type::Full => Box::new(FullMatcher(domain)),
})
Expand Down
10 changes: 8 additions & 2 deletions clash_lib/src/common/geodata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@ impl GeoData {
}
}
let bytes = tokio::fs::read(path).await?;
let cache = geodata_proto::GeoSiteList::decode(bytes.as_slice())?;
let cache =
geodata_proto::GeoSiteList::decode(bytes.as_slice()).map_err(|x| {
Error::InvalidConfig(format!("geosite decode failed: {}", x))
})?;
Ok(Self { cache })
}

#[cfg(test)]
pub async fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error> {
let bytes = tokio::fs::read(path).await?;
let cache = geodata_proto::GeoSiteList::decode(bytes.as_slice())?;
let cache =
geodata_proto::GeoSiteList::decode(bytes.as_slice()).map_err(|x| {
Error::InvalidConfig(format!("geosite decode failed: {}", x))
})?;
Ok(Self { cache })
}

Expand Down
4 changes: 0 additions & 4 deletions clash_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ pub enum Error {
IpNet(#[from] ipnet::AddrParseError),
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Decode(#[from] prost::DecodeError),
#[error(transparent)]
Regex(#[from] regex::Error),
#[error("invalid config: {0}")]
InvalidConfig(String),
#[error("profile error: {0}")]
Expand Down