Merge branch 'feat/login_ex' into main

This commit is contained in:
SolidStateDrive 2025-02-02 04:54:31 +01:00 committed by GitHub Enterprise
commit d3783ce48a
17 changed files with 875 additions and 28 deletions

View file

@ -9,6 +9,7 @@ use once_cell::sync::Lazy;
use rc4::{KeyInit, Rc4, StreamCipher};
use rc4::consts::U5;
use simplelog::{ColorChoice, CombinedLogger, Config, LevelFilter, TerminalMode, TermLogger, WriteLogger};
use crate::nex::account::Account;
use crate::protocols::auth;
use crate::protocols::server::RMCProtocolServer;
use crate::prudp::socket::Socket;
@ -21,6 +22,19 @@ mod prudp;
pub mod rmc;
mod protocols;
mod nex;
mod grpc;
static KERBEROS_SERVER_PASSWORD: Lazy<String> = Lazy::new(||{
env::var("AUTH_SERVER_PORT")
.ok()
.unwrap_or("password".to_owned())
});
static AUTH_SERVER_ACCOUNT: Lazy<Account> = Lazy::new(|| Account::new(1, "Quazal Authentication", &KERBEROS_SERVER_PASSWORD));
static SECURE_SERVER_ACCOUNT: Lazy<Account> = Lazy::new(|| Account::new(2, "Quazal Rendez-Vous", &KERBEROS_SERVER_PASSWORD));
static AUTH_SERVER_PORT: Lazy<u16> = Lazy::new(||{
env::var("AUTH_SERVER_PORT")
.ok()
@ -67,7 +81,7 @@ async fn start_servers(){
// dont assign it to the name _ as that will make it drop right here and now
let rmcserver = RMCProtocolServer::new(Box::new([
Box::new(auth::protocol)
Box::new(auth::bound_protocol(&SECURE_SERVER_ACCOUNT))
]));
let mut _socket =
@ -80,11 +94,11 @@ async fn start_servers(){
async move {
let rc4: Rc4<U5> = Rc4::new_from_slice( "CD&ML".as_bytes()).unwrap();
let cypher = Box::new(rc4);
let server_cypher: Box<dyn StreamCipher + Send + Sync> = cypher;
let server_cypher: Box<dyn StreamCipher + Send> = cypher;
let rc4: Rc4<U5> = Rc4::new_from_slice( "CD&ML".as_bytes()).unwrap();
let cypher = Box::new(rc4);
let client_cypher: Box<dyn StreamCipher + Send + Sync> = cypher;
let client_cypher: Box<dyn StreamCipher + Send> = cypher;
(true, (server_cypher, client_cypher))
}