fix: json5 unmaintained, RUSTSEC-2025-0120

This commit is contained in:
zonyitoo
2025-11-20 21:26:10 +08:00
parent e47f0b906b
commit fff99a9418
6 changed files with 25 additions and 22 deletions

View File

@@ -170,7 +170,10 @@ hickory-resolver = { version = "0.25", optional = true, features = ["serde"] }
idna = "1.0"
ipnet = "2.10"
iprange = "0.6"
regex = { version = "1.4", default-features = false, features = ["std", "perf"] }
regex = { version = "1.4", default-features = false, features = [
"std",
"perf",
] }
mime = { version = "0.3", optional = true }
flate2 = { version = "1.0", optional = true }
@@ -192,7 +195,7 @@ smoltcp = { version = "0.12", optional = true, default-features = false, feature
] }
serde = { version = "1.0", features = ["derive"] }
json5 = "0.4"
serde_json5 = "0.2"
bson = { version = "3.0.0", features = ["serde"], optional = true }
shadowsocks = { version = "1.23.2", path = "../shadowsocks", default-features = false }

View File

@@ -1457,7 +1457,7 @@ macro_rules! impl_from {
}
impl_from!(::std::io::Error, ErrorKind::IoError, "error while reading file");
impl_from!(json5::Error, ErrorKind::JsonParsingError, "json parse error");
impl_from!(serde_json5::Error, ErrorKind::JsonParsingError, "json parse error");
impl Debug for Error {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
@@ -2564,7 +2564,7 @@ impl Config {
/// Load Config from a `str`
pub fn load_from_str(s: &str, config_type: ConfigType) -> Result<Self, Error> {
let c = json5::from_str::<SSConfig>(s)?;
let c = serde_json5::from_str::<SSConfig>(s)?;
Self::load_from_ssconfig(c, config_type)
}
@@ -3178,7 +3178,7 @@ impl fmt::Display for Config {
});
}
write!(f, "{}", json5::to_string(&jconf).unwrap())
write!(f, "{}", serde_json5::to_string(&jconf).unwrap())
}
}

View File

@@ -66,7 +66,7 @@ impl Socks5AuthConfig {
let mut content = String::new();
reader.read_to_string(&mut content)?;
let jconf: SSSocks5AuthConfig = match json5::from_str(&content) {
let jconf: SSSocks5AuthConfig = match serde_json5::from_str(&content) {
Ok(c) => c,
Err(err) => return Err(io::Error::other(err)),
};