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