Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
junkurihara committed Apr 10, 2024
1 parent d96246b commit a474112
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.8.0 (Unreleased)

## 0.7.1

- deps and patches

## 0.7.0

### Important Changes
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 2 additions & 1 deletion rpxy-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 2 additions & 1 deletion rpxy-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 6 additions & 27 deletions rpxy-lib/src/crypto/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit a474112

Please sign in to comment.