Merge branch 'main' of github.com:Tensamin/Omikron
This commit is contained in:
commit
7532235ab0
3 changed files with 46 additions and 25 deletions
|
|
@ -1,23 +1,13 @@
|
|||
use crate::{
|
||||
log,
|
||||
rho::connection::GeneralConnection,
|
||||
util::file_util::{load_file_buf, load_file_vec},
|
||||
};
|
||||
use crate::{log, rho::connection::GeneralConnection, util::file_util::load_file_vec};
|
||||
use epsilon_native::Host;
|
||||
use quinn::ServerConfig;
|
||||
use rustls::{
|
||||
ServerConfig as CryptoConfig,
|
||||
crypto::{CryptoProvider, aws_lc_rs},
|
||||
pki_types::{
|
||||
CertificateDer, PrivateKeyDer,
|
||||
pem::{PemObject, SectionKind},
|
||||
},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub async fn start(port: u16) {
|
||||
let _ = aws_lc_rs::default_provider().install_default();
|
||||
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cert_pem = load_file_vec("certs", "cert.pem")
|
||||
.map_err(|e| format!("Failed to load certificate: {}", e))?;
|
||||
let key_pem = load_file_vec("certs", "key.pem")
|
||||
.map_err(|e| format!("Failed to load private key: {}", e))?;
|
||||
|
||||
<<<<<<< HEAD
|
||||
let key_pem = load_file_vec("certs", "key.pem").unwrap();
|
||||
let cert_pem = load_file_vec("certs", "cert.pem").unwrap();
|
||||
|
||||
|
|
@ -29,4 +19,22 @@ pub async fn start(port: u16) {
|
|||
});
|
||||
}
|
||||
});
|
||||
=======
|
||||
let mut host: Host = epsilon_native::host(port, cert_pem, key_pem).await?;
|
||||
log!(
|
||||
0,
|
||||
crate::util::logger::PrintType::Omikron,
|
||||
"Webtransport Server listening on port {}",
|
||||
port
|
||||
);
|
||||
|
||||
while let Some((sender, receiver)) = host.next().await {
|
||||
tokio::spawn(async move {
|
||||
let conn = GeneralConnection::new(sender, receiver);
|
||||
conn.handle().await;
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
>>>>>>> b2e6e903f789a81dd3629c21c08f03bbb430280b
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue