feat: a lot of things(i lost track)

This commit is contained in:
DJMrTV 2025-06-29 11:40:42 +02:00
commit 98193a58d8
42 changed files with 1207 additions and 366 deletions

View file

@ -1,10 +1,11 @@
use macros::RmcSerialize;
#[derive(RmcSerialize)]
#[derive(Clone)]
pub struct Account{
pub pid: u32,
pub username: Box<str>,
pub username: String,
pub kerbros_password: [u8; 16],
}
impl Account{

View file

@ -1,3 +1,6 @@
use crate::executables::common::RemoteControllerManagement;
use std::sync::Arc;
use rust_nex::executables::common::RemoteController;
use crate::grpc::account;
use crate::kerberos::{derive_key, KerberosDateTime, Ticket};
use crate::nex::account::Account;
@ -7,9 +10,9 @@ use crate::rmc::response::ErrorCode::Core_Unknown;
use crate::rmc::structures::any::Any;
use crate::rmc::structures::connection_data::ConnectionData;
use crate::rmc::structures::qresult::QResult;
use crate::rmc::structures::RmcSerialize;
use crate::{define_rmc_proto, kerberos, rmc};
use crate::{define_rmc_proto, kerberos};
use macros::rmc_struct;
use crate::rmc::protocols::OnlyRemote;
define_rmc_proto!(
proto AuthClientProtocol{
@ -21,7 +24,8 @@ define_rmc_proto!(
pub struct AuthHandler {
pub destination_server_acct: &'static Account,
pub build_name: &'static str,
pub station_url: &'static str,
//pub station_url: &'static str,
pub control_server: Arc<OnlyRemote<RemoteController>>,
}
pub fn generate_ticket(
@ -56,14 +60,14 @@ async fn get_login_data_by_pid(pid: u32) -> Option<(u32, [u8; 16])> {
}
impl Auth for AuthHandler {
async fn login(&self, name: String) -> Result<(), ErrorCode> {
async fn login(&self, _name: String) -> Result<(), ErrorCode> {
todo!()
}
async fn login_ex(
&self,
name: String,
extra_data: Any,
_extra_data: Any,
) -> Result<(QResult, u32, Vec<u8>, ConnectionData, String), ErrorCode> {
let Ok(pid) = name.parse() else {
return Err(ErrorCode::Core_InvalidArgument);
@ -83,9 +87,13 @@ impl Auth for AuthHandler {
let ticket = generate_ticket(source_login_data, destination_login_data);
let result = QResult::success(Core_Unknown);
let Ok(addr) = self.control_server.get_secure_proxy_url().await else {
return Err(ErrorCode::Core_Exception);
};
let connection_data = ConnectionData {
station_url: self.station_url.to_string(),
station_url: addr,
special_station_url: "".to_string(),
//date_time: KerberosDateTime::new(1,1,1,1,1,1),
date_time: KerberosDateTime::now(),
@ -126,11 +134,11 @@ impl Auth for AuthHandler {
Ok((result, ticket.into()))
}
async fn get_pid(&self, username: String) -> Result<u32, ErrorCode> {
async fn get_pid(&self, _username: String) -> Result<u32, ErrorCode> {
Err(ErrorCode::Core_Exception)
}
async fn get_name(&self, pid: u32) -> Result<String, ErrorCode> {
async fn get_name(&self, _pid: u32) -> Result<String, ErrorCode> {
Err(ErrorCode::Core_Exception)
}
}

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::str::FromStr;
use std::sync::{Arc, Weak};
use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering::{Relaxed, Release};
use std::sync::atomic::Ordering::Relaxed;
use std::time::Duration;
use log::info;
use rand::random;
@ -50,7 +50,7 @@ impl MatchmakeManager{
async fn garbage_collect(&self){
info!("running rnex garbage collector over all sessions and users");
let mut idx = 0;
let idx = 0;
let mut to_be_deleted_gids = Vec::new();
@ -64,7 +64,7 @@ impl MatchmakeManager{
session_pair
}{
let mut session = session.lock().await;
let session = session.lock().await;
if !session.is_reachable(){
to_be_deleted_gids.push(gid);

View file

@ -1,8 +1,6 @@
use macros::rmc_struct;
use crate::rmc::protocols::notifications::{Notification, NotificationEvent, RawNotification, RawNotificationInfo, RemoteNotification};
use crate::rmc::protocols::notifications::{Notification, RawNotification, RawNotificationInfo, RemoteNotification};
use crate::rmc::protocols::nat_traversal::{NatTraversalConsole, RemoteNatTraversalConsole, RawNatTraversalConsoleInfo, RawNatTraversalConsole};
use crate::define_rmc_proto;
use crate::nex::user::RemoteUserProtocol;
define_rmc_proto!(
proto Console{

View file

@ -1,14 +1,12 @@
use std::io::ErrorKind::HostUnreachable;
use crate::define_rmc_proto;
use crate::nex::matchmake::{ExtendedMatchmakeSession, MatchmakeManager};
use crate::nex::remote_console::RemoteConsole;
use crate::prudp::sockaddr::PRUDPSockAddr;
use crate::prudp::station_url::Type::{PRUDP, PRUDPS};
use crate::prudp::station_url::UrlOptions::{
Address, NatFiltering, NatMapping, NatType, Platform, Port, PrincipalID, RVConnectionID,
StreamID, PMP, UPNP,
Address, NatFiltering, NatMapping, NatType, Port, PrincipalID, RVConnectionID,
};
use crate::prudp::station_url::{nat_types, StationUrl, Type};
use crate::prudp::station_url::{StationUrl};
use crate::rmc::protocols::matchmake::{
Matchmake, RawMatchmake, RawMatchmakeInfo, RemoteMatchmake,
};
@ -24,15 +22,12 @@ use crate::rmc::structures::matchmake::{AutoMatchmakeParam, CreateMatchmakeSessi
use crate::rmc::structures::qresult::QResult;
use macros::rmc_struct;
use std::net::{Ipv4Addr, SocketAddrV4};
use std::sync::{Arc, Weak};
use log::{error, info};
use rocket::http::ext::IntoCollection;
use log::info;
use tokio::sync::{Mutex, RwLock};
use tonic::Code::InvalidArgument;
use crate::prudp::station_url::nat_types::PUBLIC;
use crate::rmc::protocols::notifications::{NotificationEvent, RemoteNotification};
use crate::rmc::response::ErrorCode::{Core_Exception, Core_InvalidArgument, RendezVous_AccountExpired, RendezVous_SessionVoid};
use crate::rmc::response::ErrorCode::{Core_Exception, Core_InvalidArgument, RendezVous_AccountExpired};
define_rmc_proto!(
proto UserProtocol{
@ -129,7 +124,7 @@ impl Secure for User {
public_station
};
let mut both = [&mut public_station, &mut private_station];
let both = [&mut public_station, &mut private_station];
for station in both {
station.options.retain(|v| {
@ -208,7 +203,7 @@ impl MatchmakeExtension for User {
Ok(())
}
async fn get_playing_session(&self, pids: Vec<u32>) -> Result<Vec<()>, ErrorCode> {
async fn get_playing_session(&self, _pids: Vec<u32>) -> Result<Vec<()>, ErrorCode> {
Ok(Vec::new())
}
@ -385,7 +380,7 @@ impl MatchmakeExtension for User {
}
impl Matchmake for User {
async fn unregister_gathering(&self, gid: u32) -> Result<bool, ErrorCode> {
async fn unregister_gathering(&self, _gid: u32) -> Result<bool, ErrorCode> {
Ok(true)
}
async fn get_session_urls(&self, gid: u32) -> Result<Vec<StationUrl>, ErrorCode> {
@ -460,7 +455,7 @@ impl Matchmake for User {
Ok(())
}
async fn migrate_gathering_ownership(&self, gid: u32, candidates: Vec<u32>, participants_only: bool) -> Result<(), ErrorCode> {
async fn migrate_gathering_ownership(&self, gid: u32, candidates: Vec<u32>, _participants_only: bool) -> Result<(), ErrorCode> {
let session = self.matchmake_manager.get_session(gid).await?;
let mut session = session.lock().await;
@ -522,11 +517,11 @@ impl NatTraversal for User {
Ok(())
}
async fn report_nat_traversal_result(&self, cid: u32, result: bool, rtt: u32) -> Result<(), ErrorCode> {
async fn report_nat_traversal_result(&self, _cid: u32, _result: bool, _rtt: u32) -> Result<(), ErrorCode> {
Ok(())
}
async fn request_probe_initiation(&self, station_to_probe: String) -> Result<(), ErrorCode> {
async fn request_probe_initiation(&self, _station_to_probe: String) -> Result<(), ErrorCode> {
info!("NO!");
Err(RendezVous_AccountExpired)
}