[FIX] WTRANSPORT WORKS (it was Alois fault)
This commit is contained in:
parent
3db52de920
commit
f181fbea9b
2 changed files with 29 additions and 41 deletions
32
Cargo.lock
generated
32
Cargo.lock
generated
|
|
@ -266,7 +266,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"smallvec",
|
||||
"socket2 0.6.2",
|
||||
"socket2 0.6.3",
|
||||
"time",
|
||||
"tracing",
|
||||
"url",
|
||||
|
|
@ -1171,7 +1171,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "epsilon-core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Tensamin/Epsilon.git#4bdd32b44a77ac980cede20a1d401004f52e4a29"
|
||||
source = "git+https://github.com/Tensamin/Epsilon.git#44e3a3ec0ee6ac4c00f8cfb7c20c3299c7ae89c5"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"quinn",
|
||||
|
|
@ -1183,7 +1183,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "epsilon-native"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Tensamin/Epsilon.git#4bdd32b44a77ac980cede20a1d401004f52e4a29"
|
||||
source = "git+https://github.com/Tensamin/Epsilon.git#44e3a3ec0ee6ac4c00f8cfb7c20c3299c7ae89c5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -1193,9 +1193,11 @@ dependencies = [
|
|||
"quinn",
|
||||
"rcgen",
|
||||
"rustls",
|
||||
"rustls-native-certs",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"wtransport",
|
||||
"wtransport-proto",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1799,7 +1801,7 @@ dependencies = [
|
|||
"libc",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"socket2 0.6.2",
|
||||
"socket2 0.6.3",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
|
|
@ -2705,7 +2707,7 @@ dependencies = [
|
|||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustls",
|
||||
"socket2 0.6.2",
|
||||
"socket2 0.6.3",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
|
@ -2745,16 +2747,16 @@ dependencies = [
|
|||
"cfg_aliases",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2 0.6.2",
|
||||
"socket2 0.6.3",
|
||||
"tracing",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.44"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
||||
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
|
@ -2842,6 +2844,7 @@ version = "0.14.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10b99e0098aa4082912d4c649628623db6aba77335e4f4569ff5083a6448b32e"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"pem",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
|
|
@ -3344,12 +3347,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"
|
||||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3801,7 +3804,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2 0.6.2",
|
||||
"socket2 0.6.3",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
|
@ -4071,9 +4074,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.21.0"
|
||||
version = "1.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb"
|
||||
checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37"
|
||||
dependencies = [
|
||||
"getrandom 0.4.2",
|
||||
"js-sys",
|
||||
|
|
@ -4921,6 +4924,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202"
|
||||
dependencies = [
|
||||
"asn1-rs",
|
||||
"aws-lc-rs",
|
||||
"data-encoding",
|
||||
"der-parser",
|
||||
"lazy_static",
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ impl OmikronConnection {
|
|||
// Main Handler Loop
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
pub async fn handle(self: Arc<Self>, mut receiver: Receiver) {
|
||||
pub async fn handle(self: Arc<Self>, receiver: Receiver) {
|
||||
log_in!(
|
||||
self.id as i64,
|
||||
PrintType::Omega,
|
||||
|
|
@ -227,7 +227,8 @@ impl OmikronConnection {
|
|||
|
||||
async fn handle_unauthenticated(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
|
||||
if !cv.is_type(CommunicationType::identification) {
|
||||
self.send_error_response(cv.get_id(), CommunicationType::error_not_authenticated)
|
||||
let _ = self
|
||||
.send_error_response(cv.get_id(), CommunicationType::error_not_authenticated)
|
||||
.await;
|
||||
return Err(OmikronError::NotAuthenticated);
|
||||
}
|
||||
|
|
@ -280,7 +281,8 @@ impl OmikronConnection {
|
|||
|
||||
async fn handle_identified(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
|
||||
if !cv.is_type(CommunicationType::challenge_response) {
|
||||
self.send_error_response(cv.get_id(), CommunicationType::error_not_authenticated)
|
||||
let _ = self
|
||||
.send_error_response(cv.get_id(), CommunicationType::error_not_authenticated)
|
||||
.await;
|
||||
return Err(OmikronError::NotAuthenticated);
|
||||
}
|
||||
|
|
@ -306,7 +308,8 @@ impl OmikronConnection {
|
|||
log_in!(omikron_id, PrintType::Omega, "Omikron authenticated");
|
||||
Ok(())
|
||||
} else {
|
||||
self.send_error_response(cv.get_id(), CommunicationType::error_invalid_challenge)
|
||||
let _ = self
|
||||
.send_error_response(cv.get_id(), CommunicationType::error_invalid_challenge)
|
||||
.await;
|
||||
Err(OmikronError::AuthenticationFailed)
|
||||
}
|
||||
|
|
@ -1114,11 +1117,11 @@ impl OmikronConnection {
|
|||
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let _ = aws_lc_rs::default_provider().install_default();
|
||||
|
||||
let tls_cfg = load_tls().expect("TLS config failed");
|
||||
let server_crypto = quinn::crypto::rustls::QuicServerConfig::try_from(tls_cfg)?;
|
||||
let server_cfg = ServerConfig::with_crypto(Arc::new(server_crypto));
|
||||
let cert_pem = load_file_vec("certs", "cert.pem").expect("Error loading Pemfile");
|
||||
|
||||
let mut host: Host = epsilon_native::host(port, server_cfg).await?;
|
||||
let key_pem = load_file_vec("certs", "key.pem").expect("Error loading Keyfile");
|
||||
|
||||
let mut host: Host = epsilon_native::host(port, cert_pem, key_pem).await?;
|
||||
log!("OmikronServer listening on port {}", port);
|
||||
|
||||
while let Some((sender, receiver)) = host.next().await {
|
||||
|
|
@ -1130,22 +1133,3 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn load_tls() -> Option<CryptoConfig> {
|
||||
let _ = aws_lc_rs::default_provider().install_default();
|
||||
|
||||
let mut cert_pem = load_file_buf("certs", "cert.pem").ok()?;
|
||||
let cert_chain = rustls_pemfile::certs(&mut cert_pem)
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.ok()?;
|
||||
|
||||
let key_pem = load_file_vec("certs", "key.pem").ok()?;
|
||||
let key_der = rustls_pemfile::private_key(&mut &*key_pem).ok()??;
|
||||
|
||||
let cfg = CryptoConfig::builder()
|
||||
.with_no_client_auth()
|
||||
.with_single_cert(cert_chain, key_der)
|
||||
.ok()?;
|
||||
|
||||
Some(cfg)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue