chore: refactor

This commit is contained in:
Jun Kurihara 2024-04-10 13:30:31 +09:00
commit a4741127a5
No known key found for this signature in database
GPG key ID: 6D3FEE70E498C15B
6 changed files with 16 additions and 31 deletions

View file

@ -2,6 +2,10 @@
## 0.8.0 (Unreleased)
## 0.7.1
- deps and patches
## 0.7.0
### Important Changes

View file

@ -1,5 +1,5 @@
[workspace.package]
version = "0.7.0"
version = "0.7.1"
authors = ["Jun Kurihara"]
homepage = "https://github.com/junkurihara/rust-rpxy"
repository = "https://github.com/junkurihara/rust-rpxy"

View file

@ -13,7 +13,8 @@ publish.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["http3-quinn", "cache", "rustls-backend"]
# default = ["http3-quinn", "cache", "rustls-backend"]
default = ["http3-s2n", "cache", "native-tls-backend"]
http3-quinn = ["rpxy-lib/http3-quinn"]
http3-s2n = ["rpxy-lib/http3-s2n"]
native-tls-backend = ["rpxy-lib/native-tls-backend"]

View file

@ -13,7 +13,8 @@ publish.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["http3-quinn", "sticky-cookie", "cache", "rustls-backend"]
# default = ["http3-quinn", "sticky-cookie", "cache", "rustls-backend"]
default = ["http3-s2n", "sticky-cookie", "cache", "rustls-backend"]
http3-quinn = ["socket2", "quinn", "h3", "h3-quinn"]
http3-s2n = [
"h3",

View file

@ -99,11 +99,7 @@ impl ServerCryptoBase {
// add server certificate and key
if let Err(e) = resolver_local.add(server_name.as_str(), certified_key.to_owned()) {
error!(
"{}: Failed to read some certificates and keys {}",
server_name.as_str(),
e
)
error!("{}: Failed to read some certificates and keys {}", server_name.as_str(), e)
}
// add client certificate if specified
@ -114,11 +110,7 @@ impl ServerCryptoBase {
client_ca_roots_local.add_trust_anchors(owned_trust_anchors.into_iter());
}
Err(e) => {
warn!(
"Failed to add client CA certificate for {}: {}",
server_name.as_str(),
e
);
warn!("Failed to add client CA certificate for {}: {}", server_name.as_str(), e);
}
}
}
@ -174,11 +166,7 @@ impl ServerCryptoBase {
if certs_and_keys.client_ca_certs.is_none() {
// aggregated server config for no client auth server for http3
if let Err(e) = resolver_global.add(server_name.as_str(), certified_key) {
error!(
"{}: Failed to read some certificates and keys {}",
server_name.as_str(),
e
)
error!("{}: Failed to read some certificates and keys {}", server_name.as_str(), e)
}
}
}
@ -216,15 +204,11 @@ impl ServerCryptoBase {
if certs_and_keys.client_ca_certs.is_none() {
// aggregated server config for no client auth server for http3
if let Err(e) = resolver_global.add(server_name.as_str(), certified_key) {
error!(
"{}: Failed to read some certificates and keys {}",
server_name.as_str(),
e
)
error!("{}: Failed to read some certificates and keys {}", server_name.as_str(), e)
}
}
}
let alpn = vec![
let alpn = [
b"h3".to_vec(),
b"hq-29".to_vec(), // TODO: remove later?
b"h2".to_vec(),
@ -257,12 +241,7 @@ fn parse_server_certs_and_keys_s2n(
None
}
})
.ok_or_else(|| {
std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"Unable to find a valid certificate and key",
)
})?;
.ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidInput, "Unable to find a valid certificate and key"))?;
let certs: Vec<_> = certs_and_keys
.certs
.iter()

@ -1 +1 @@
Subproject commit b44edeb60d234d49c45828395108f7519a048d4b
Subproject commit e7c7ab9d634ef73784d6cbc424a270dbaa4f1c99