chore: anti pretendo people note and cleanup
This commit is contained in:
parent
4e83068662
commit
c698e0b3dd
25 changed files with 69 additions and 682 deletions
|
|
@ -1,32 +1,17 @@
|
|||
use rnex_core::reggie::{RemoteEdgeNodeHolder, UnitPacketRead};
|
||||
use log::{error, info};
|
||||
use once_cell::sync::Lazy;
|
||||
use rustls::client::danger::HandshakeSignatureValid;
|
||||
use rustls::pki_types::{CertificateDer, TrustAnchor, UnixTime};
|
||||
use rustls::server::danger::{ClientCertVerified, ClientCertVerifier};
|
||||
use rustls::server::{ClientCertVerifierBuilder, WebPkiClientVerifier};
|
||||
use rustls::{
|
||||
DigitallySignedStruct, DistinguishedName, Error, RootCertStore, ServerConfig, ServerConnection,
|
||||
SignatureScheme,
|
||||
};
|
||||
use rustls_pki_types::PrivateKeyDer;
|
||||
use rnex_core::common::setup;
|
||||
use std::borrow::ToOwned;
|
||||
use std::{env, fs};
|
||||
use std::{env};
|
||||
use std::io::Cursor;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, SocketAddrV4};
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::Arc;
|
||||
use macros::{method_id, rmc_proto, rmc_struct};
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio::net::{TcpListener, TcpSocket, TcpStream};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::task;
|
||||
use tokio_rustls::TlsAcceptor;
|
||||
use rnex_core::define_rmc_proto;
|
||||
use rnex_core::executables::common::{OWN_IP_PRIVATE, SECURE_SERVER_ACCOUNT, SERVER_PORT};
|
||||
use rnex_core::nex::auth_handler::AuthHandler;
|
||||
use rnex_core::reggie::EdgeNodeHolderConnectOption::DontRegister;
|
||||
use rnex_core::rmc::protocols::{new_rmc_gateway_connection, OnlyRemote};
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
|
|
@ -57,7 +42,7 @@ async fn main() {
|
|||
|
||||
|
||||
|
||||
while let Ok((mut stream, addr)) = listen.accept().await {
|
||||
while let Ok((mut stream, _addr)) = listen.accept().await {
|
||||
let buffer = match stream.read_buffer().await{
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
|
|
@ -68,7 +53,7 @@ async fn main() {
|
|||
|
||||
let user_connection_data = ConnectionInitData::deserialize(&mut Cursor::new(buffer));
|
||||
|
||||
let user_connection_data = match user_connection_data{
|
||||
let _user_connection_data = match user_connection_data{
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("an error ocurred whilest reading connection data: {:?}", e);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
use std::io::Cursor;
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use rnex_core::reggie::{RemoteEdgeNodeHolder, UnitPacketRead};
|
||||
use rnex_core::reggie::UnitPacketRead;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicU32;
|
||||
use log::{error, info};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::task;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::executables::common::{OWN_IP_PRIVATE, SERVER_PORT};
|
||||
use rnex_core::nex::matchmake::MatchmakeManager;
|
||||
use rnex_core::nex::remote_console::RemoteConsole;
|
||||
use rnex_core::nex::user::User;
|
||||
use rnex_core::reggie::EdgeNodeHolderConnectOption::DontRegister;
|
||||
use rnex_core::rmc::protocols::{new_rmc_gateway_connection, OnlyRemote};
|
||||
use rnex_core::rmc::protocols::new_rmc_gateway_connection;
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_core::rmc::protocols::RemoteInstantiatable;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
|
@ -35,7 +33,7 @@ async fn main() {
|
|||
|
||||
MatchmakeManager::initialize_garbage_collect_thread(weak_mmm).await;
|
||||
|
||||
while let Ok((mut stream, addr)) = listen.accept().await {
|
||||
while let Ok((mut stream, _addr)) = listen.accept().await {
|
||||
let buffer = match stream.read_buffer().await{
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
use std::env;
|
||||
use std::net::{Ipv4Addr, SocketAddrV4};
|
||||
use macros::{method_id, rmc_proto, RmcSerialize};
|
||||
use std::net::Ipv4Addr;
|
||||
use once_cell::sync::Lazy;
|
||||
use tonic::transport::Server;
|
||||
use crate::define_rmc_proto;
|
||||
use crate::prudp::station_url::StationUrl;
|
||||
use crate::nex::account::Account;
|
||||
use crate::rmc::response::ErrorCode;
|
||||
|
||||
pub static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
||||
env::var("SERVER_IP")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use std::io::Cursor;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::{Arc, Weak};
|
||||
use log::error;
|
||||
use macros::rmc_struct;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::sync::RwLock;
|
||||
|
|
@ -56,7 +55,7 @@ async fn main() {
|
|||
|
||||
let holder: Arc<DataHolder> = Default::default();
|
||||
|
||||
while let Ok((mut stream, addr)) = listen.accept().await {
|
||||
while let Ok((stream, _addr)) = listen.accept().await {
|
||||
let mut conn: SplittableBufferConnection = stream.into();
|
||||
|
||||
let Some(data) = conn.recv().await else {
|
||||
|
|
|
|||
|
|
@ -11,40 +11,15 @@
|
|||
extern crate self as rust_nex;
|
||||
|
||||
use crate::nex::account::Account;
|
||||
use crate::nex::auth_handler::{AuthHandler, RemoteAuthClientProtocol};
|
||||
use crate::nex::remote_console::RemoteConsole;
|
||||
use crate::nex::user::{RemoteUserProtocol, User};
|
||||
use crate::rmc::protocols::auth::Auth;
|
||||
use crate::rmc::protocols::auth::RawAuth;
|
||||
use crate::rmc::protocols::auth::RawAuthInfo;
|
||||
use crate::rmc::protocols::auth::RemoteAuth;
|
||||
use crate::rmc::protocols::matchmake_extension::RemoteMatchmakeExtension;
|
||||
use crate::rmc::protocols::{new_rmc_gateway_connection, OnlyRemote, RemoteInstantiatable};
|
||||
use crate::rmc::response::ErrorCode;
|
||||
use crate::rmc::structures::any::Any;
|
||||
use crate::rmc::structures::connection_data::ConnectionData;
|
||||
use crate::rmc::structures::matchmake::{CreateMatchmakeSessionParam, Gathering, MatchmakeParam, MatchmakeSession};
|
||||
use crate::rmc::structures::qresult::QResult;
|
||||
use chrono::{Local, SecondsFormat};
|
||||
use log::{error, info};
|
||||
use macros::rmc_struct;
|
||||
use once_cell::sync::Lazy;
|
||||
use simplelog::{
|
||||
ColorChoice, CombinedLogger, Config, LevelFilter, TermLogger, TerminalMode, WriteLogger,
|
||||
};
|
||||
use std::fs::File;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::{Ipv4Addr, SocketAddrV4};
|
||||
use std::ops::{BitAnd, BitOr};
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Once, Weak};
|
||||
use std::time::Duration;
|
||||
use std::net::{Ipv4Addr};
|
||||
use std::sync::Once;
|
||||
use std::{env, fs};
|
||||
use std::sync::atomic::AtomicU32;
|
||||
use tokio::task::JoinHandle;
|
||||
use crate::kerberos::KerberosDateTime;
|
||||
use crate::nex::matchmake::MatchmakeManager;
|
||||
use crate::rmc::protocols::secure::RemoteSecure;
|
||||
|
||||
mod prudp;
|
||||
pub mod rmc;
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ impl ExtendedMatchmakeSession{
|
|||
};
|
||||
|
||||
|
||||
let other_pid = other_conn.pid;
|
||||
// let other_pid = other_conn.pid;
|
||||
/*if other_pid == self.session.gathering.owner_pid &&
|
||||
joining_pid == self.session.gathering.owner_pid{
|
||||
continue;
|
||||
|
|
@ -341,7 +341,7 @@ impl ExtendedMatchmakeSession{
|
|||
}
|
||||
|
||||
pub async fn migrate_host(&mut self, initiator_pid: u32) -> Result<(), ErrorCode>{
|
||||
let players: Vec<_> = self.connected_players.iter().filter_map(|p| p.upgrade()).collect();
|
||||
// let players: Vec<_> = self.connected_players.iter().filter_map(|p| p.upgrade()).collect();
|
||||
|
||||
self.session.gathering.host_pid = self.session.gathering.owner_pid;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ impl PRUDPSockAddr{
|
|||
pub fn calculate_connection_signature(&self) -> [u8; 16] {
|
||||
let mut hmac = Md5Hmac::new_from_slice(&[0; 16]).expect("fuck");
|
||||
|
||||
let mut data = self.regular_socket_addr.ip().octets().to_vec();
|
||||
let data = self.regular_socket_addr.ip().octets().to_vec();
|
||||
//data.extend_from_slice(&self.regular_socket_addr.port().to_be_bytes());
|
||||
|
||||
hmac.write_all(&data).expect("figuring this out was complete ass");
|
||||
|
|
|
|||
|
|
@ -1,29 +1,8 @@
|
|||
use std::{env, fs, io};
|
||||
use std::hash::Hash;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::net::{SocketAddrV4, ToSocketAddrs};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use macros::{method_id, rmc_proto, rmc_struct, RmcSerialize};
|
||||
use once_cell::sync::Lazy;
|
||||
use rustls::{ClientConfig, RootCertStore, ServerConfig};
|
||||
use rustls::client::WebPkiServerVerifier;
|
||||
use rustls::server::WebPkiClientVerifier;
|
||||
use rustls_pki_types::{CertificateDer, PrivateKeyDer, ServerName, TrustAnchor};
|
||||
use thiserror::Error;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio_rustls::{TlsAcceptor, TlsConnector};
|
||||
use tokio_rustls::client::TlsStream;
|
||||
use tokio_tungstenite::{connect_async, MaybeTlsStream, WebSocketStream};
|
||||
use tokio_tungstenite::tungstenite::Message;
|
||||
use webpki::anchor_from_trusted_cert;
|
||||
use crate::common::setup;
|
||||
use std::io;
|
||||
use std::net::SocketAddrV4;
|
||||
use macros::{method_id, rmc_proto, RmcSerialize};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
use crate::define_rmc_proto;
|
||||
use crate::nex::account::Account;
|
||||
use crate::rmc::protocols::{new_rmc_gateway_connection, OnlyRemote, RmcCallable, RmcConnection};
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use crate::rmc::structures::RmcSerialize;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ pub trait Matchmake{
|
|||
async fn unregister_gathering(&self, gid: u32) -> Result<bool, ErrorCode>;
|
||||
#[method_id(41)]
|
||||
async fn get_session_urls(&self, gid: u32) -> Result<Vec<StationUrl>, ErrorCode>;
|
||||
|
||||
#[method_id(42)]
|
||||
async fn update_session_host(&self, gid: u32, change_owner: bool) -> Result<(), ErrorCode>;
|
||||
|
||||
#[method_id(44)]
|
||||
async fn migrate_gathering_ownership(&self, gid: u32, candidates: Vec<u32>, participants_only: bool) -> Result<(), ErrorCode>;
|
||||
}
|
||||
|
|
@ -153,6 +153,7 @@ macro_rules! define_rmc_proto {
|
|||
$($protocol:path),*
|
||||
}) => {
|
||||
paste::paste!{
|
||||
#[allow(unused_variables)]
|
||||
pub trait [<Local $name>]: std::any::Any $( + [<Raw $protocol>] + $protocol)* {
|
||||
async fn rmc_call(&self, remote_response_connection: &rnex_core::util::SendingBufferConnection, protocol_id: u16, method_id: u32, call_id: u32, rest: Vec<u8>){
|
||||
match protocol_id{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use std::array::from_fn;
|
||||
use std::io::{Read, Write};
|
||||
use std::mem::MaybeUninit;
|
||||
use bytemuck::bytes_of;
|
||||
use serde::Serialize;
|
||||
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
|
||||
use crate::rmc::structures::RmcSerialize;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ pub trait RmcSerialize{
|
|||
}
|
||||
|
||||
impl RmcSerialize for (){
|
||||
fn serialize(&self, writer: &mut dyn Write) -> Result<()> {
|
||||
fn serialize(&self, _writer: &mut dyn Write) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn deserialize(reader: &mut dyn Read) -> Result<Self> {
|
||||
fn deserialize(_reader: &mut dyn Read) -> Result<Self> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ impl SplittableBufferConnection {
|
|||
}
|
||||
}
|
||||
}
|
||||
stream.shutdown().await;
|
||||
if let Err(e) = stream.shutdown().await{
|
||||
error!("failed to shut down stream: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct RnexApiAuth;
|
|||
impl<'r> FromRequest<'r> for RnexApiAuth{
|
||||
|
||||
type Error = ();
|
||||
async fn from_request<'a>(request: &'r Request<'a>) -> Outcome<Self, Self::Error> {
|
||||
async fn from_request<'a>(_request: &'r Request<'a>) -> Outcome<Self, Self::Error> {
|
||||
Outcome::Success(RnexApiAuth)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue