fix: rename crate to rust_nex
This commit is contained in:
parent
9da91bb835
commit
35cee07591
10 changed files with 87 additions and 87 deletions
84
Cargo.lock
generated
84
Cargo.lock
generated
|
|
@ -2203,6 +2203,48 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-nex"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytemuck",
|
||||
"chacha20",
|
||||
"chrono",
|
||||
"ctrlc",
|
||||
"dotenv",
|
||||
"futures",
|
||||
"hex",
|
||||
"hmac",
|
||||
"json",
|
||||
"log",
|
||||
"macros",
|
||||
"md-5",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"prost",
|
||||
"rand 0.8.5",
|
||||
"rc4",
|
||||
"reqwest",
|
||||
"rocket",
|
||||
"rsa",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"serde",
|
||||
"sha2",
|
||||
"simplelog",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-stream",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"typenum",
|
||||
"v_byte_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.25"
|
||||
|
|
@ -2483,48 +2525,6 @@ dependencies = [
|
|||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "splatoon-server-rust"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytemuck",
|
||||
"chacha20",
|
||||
"chrono",
|
||||
"ctrlc",
|
||||
"dotenv",
|
||||
"futures",
|
||||
"hex",
|
||||
"hmac",
|
||||
"json",
|
||||
"log",
|
||||
"macros",
|
||||
"md-5",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"prost",
|
||||
"rand 0.8.5",
|
||||
"rc4",
|
||||
"reqwest",
|
||||
"rocket",
|
||||
"rsa",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"serde",
|
||||
"sha2",
|
||||
"simplelog",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-stream",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"typenum",
|
||||
"v_byte_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable-pattern"
|
||||
version = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "splatoon-server-rust"
|
||||
name = "rust-nex"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
|||
|
||||
quote! {
|
||||
#pre_inner
|
||||
splatoon_server_rust::rmc::structures::rmc_struct::write_struct(writer, #version, |mut writer|{
|
||||
rust_nex::rmc::structures::rmc_struct::write_struct(writer, #version, |mut writer|{
|
||||
#serialize_base_content
|
||||
})?;
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
|||
|
||||
quote! {
|
||||
#pre_inner
|
||||
Ok(splatoon_server_rust::rmc::structures::rmc_struct::read_struct(reader, #version, move |mut reader|{
|
||||
Ok(rust_nex::rmc::structures::rmc_struct::read_struct(reader, #version, move |mut reader|{
|
||||
#deserialize_base_content
|
||||
})?)
|
||||
}
|
||||
|
|
@ -229,14 +229,14 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
|||
let ident = derive_input.ident;
|
||||
|
||||
let tokens = quote! {
|
||||
impl splatoon_server_rust::rmc::structures::RmcSerialize for #ident{
|
||||
fn serialize(&self, writer: &mut dyn ::std::io::Write) -> splatoon_server_rust::rmc::structures::Result<()>{
|
||||
impl rust_nex::rmc::structures::RmcSerialize for #ident{
|
||||
fn serialize(&self, writer: &mut dyn ::std::io::Write) -> rust_nex::rmc::structures::Result<()>{
|
||||
#serialize_base_content
|
||||
|
||||
|
||||
}
|
||||
|
||||
fn deserialize(reader: &mut dyn ::std::io::Read) -> splatoon_server_rust::rmc::structures::Result<Self>{
|
||||
fn deserialize(reader: &mut dyn ::std::io::Read) -> rust_nex::rmc::structures::Result<Self>{
|
||||
#deserialize_base_content
|
||||
}
|
||||
}
|
||||
|
|
@ -367,8 +367,8 @@ pub fn rmc_struct(attr: TokenStream, input: TokenStream) -> TokenStream{
|
|||
|
||||
}
|
||||
|
||||
impl splatoon_server_rust::rmc::protocols::RmcCallable for #struct_name{
|
||||
async fn rmc_call(&self, remote_response_connection: &splatoon_server_rust::util::SendingBufferConnection, protocol_id: u16, method_id: u32, call_id: u32, rest: Vec<u8>){
|
||||
impl rust_nex::rmc::protocols::RmcCallable for #struct_name{
|
||||
async fn rmc_call(&self, remote_response_connection: &rust_nex::util::SendingBufferConnection, protocol_id: u16, method_id: u32, call_id: u32, rest: Vec<u8>){
|
||||
<Self as #ident>::rmc_call(self, remote_response_connection, protocol_id, method_id, call_id, rest).await;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ impl RmcProtocolData{
|
|||
for (param_name, param_type) in parameters{
|
||||
quote!{
|
||||
let Ok(#param_name) =
|
||||
<#param_type as splatoon_server_rust::rmc::structures::RmcSerialize>::deserialize(
|
||||
<#param_type as rust_nex::rmc::structures::RmcSerialize>::deserialize(
|
||||
&mut cursor
|
||||
) else
|
||||
}.to_tokens(tokens);
|
||||
|
|
@ -84,7 +84,7 @@ impl RmcProtocolData{
|
|||
quote! {
|
||||
{
|
||||
log::error!(#error_msg);
|
||||
return Err(splatoon_server_rust::rmc::response::ErrorCode::Core_InvalidArgument);
|
||||
return Err(rust_nex::rmc::response::ErrorCode::Core_InvalidArgument);
|
||||
};
|
||||
}.to_tokens(tokens)
|
||||
} else {
|
||||
|
|
@ -116,7 +116,7 @@ impl RmcProtocolData{
|
|||
quote!{
|
||||
let retval = retval?;
|
||||
let mut vec = Vec::new();
|
||||
splatoon_server_rust::rmc::structures::RmcSerialize::serialize(&retval, &mut vec).ok();
|
||||
rust_nex::rmc::structures::RmcSerialize::serialize(&retval, &mut vec).ok();
|
||||
Ok(vec)
|
||||
}.to_tokens(tokens);
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ impl RmcProtocolData{
|
|||
quote!{
|
||||
async fn rmc_call_proto(
|
||||
&self,
|
||||
remote_response_connection: &splatoon_server_rust::util::SendingBufferConnection,
|
||||
remote_response_connection: &rust_nex::util::SendingBufferConnection,
|
||||
method_id: u32,
|
||||
call_id: u32,
|
||||
data: Vec<u8>,
|
||||
|
|
@ -165,7 +165,7 @@ impl RmcProtocolData{
|
|||
}.to_tokens(tokens);
|
||||
if self.has_returns {
|
||||
quote! {
|
||||
Err(splatoon_server_rust::rmc::response::ErrorCode::Core_NotImplemented)
|
||||
Err(rust_nex::rmc::response::ErrorCode::Core_NotImplemented)
|
||||
}.to_tokens(tokens);
|
||||
}
|
||||
});
|
||||
|
|
@ -176,7 +176,7 @@ impl RmcProtocolData{
|
|||
|
||||
if *has_returns{
|
||||
quote!{
|
||||
splatoon_server_rust::rmc::response::send_result(
|
||||
rust_nex::rmc::response::send_result(
|
||||
remote_response_connection,
|
||||
ret,
|
||||
#id,
|
||||
|
|
@ -209,7 +209,7 @@ impl RmcProtocolData{
|
|||
// boilerplate tokens which all raw traits need
|
||||
quote!{
|
||||
#[doc(hidden)]
|
||||
pub trait #remote_name: splatoon_server_rust::rmc::protocols::HasRmcConnection
|
||||
pub trait #remote_name: rust_nex::rmc::protocols::HasRmcConnection
|
||||
}.to_tokens(tokens);
|
||||
|
||||
// generate the body of the raw protocol trait
|
||||
|
|
@ -247,12 +247,12 @@ impl RmcProtocolData{
|
|||
|
||||
for (param_name, param_type) in parameters{
|
||||
quote!{
|
||||
splatoon_server_rust::result::ResultExtension::display_err_or_some(
|
||||
<#param_type as splatoon_server_rust::rmc::structures::RmcSerialize>::serialize(
|
||||
rust_nex::result::ResultExtension::display_err_or_some(
|
||||
<#param_type as rust_nex::rmc::structures::RmcSerialize>::serialize(
|
||||
&#param_name,
|
||||
&mut cursor
|
||||
)
|
||||
).ok_or(splatoon_server_rust::rmc::response::ErrorCode::Core_InvalidArgument)
|
||||
).ok_or(rust_nex::rmc::response::ErrorCode::Core_InvalidArgument)
|
||||
}.to_tokens(tokens);
|
||||
if self.has_returns {
|
||||
quote! {
|
||||
|
|
@ -268,25 +268,25 @@ impl RmcProtocolData{
|
|||
quote!{
|
||||
let call_id = rand::random();
|
||||
|
||||
let message = splatoon_server_rust::rmc::message::RMCMessage{
|
||||
let message = rust_nex::rmc::message::RMCMessage{
|
||||
call_id,
|
||||
method_id: #method_id,
|
||||
protocol_id: #proto_id,
|
||||
rest_of_data: send_data
|
||||
};
|
||||
|
||||
let rmc_conn = <Self as splatoon_server_rust::rmc::protocols::HasRmcConnection>::get_connection(self);
|
||||
let rmc_conn = <Self as rust_nex::rmc::protocols::HasRmcConnection>::get_connection(self);
|
||||
}.to_tokens(tokens);
|
||||
|
||||
if *has_returns{
|
||||
quote!{
|
||||
splatoon_server_rust::result::ResultExtension::display_err_or_some(
|
||||
rust_nex::result::ResultExtension::display_err_or_some(
|
||||
rmc_conn.make_raw_call(&message).await
|
||||
).ok_or(splatoon_server_rust::rmc::response::ErrorCode::Core_Exception)
|
||||
).ok_or(rust_nex::rmc::response::ErrorCode::Core_Exception)
|
||||
}.to_tokens(tokens);
|
||||
} else {
|
||||
quote!{
|
||||
splatoon_server_rust::result::ResultExtension::display_err_or_some(
|
||||
rust_nex::result::ResultExtension::display_err_or_some(
|
||||
rmc_conn.make_raw_call_no_response(&message).await
|
||||
);
|
||||
}.to_tokens(tokens);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ use rustls::{
|
|||
SignatureScheme,
|
||||
};
|
||||
use rustls_pki_types::PrivateKeyDer;
|
||||
use splatoon_server_rust::common::setup;
|
||||
use splatoon_server_rust::reggie::{get_configured_tls_acceptor, TestStruct, ROOT_TRUST_ANCHOR, SELF_CERT, SELF_KEY};
|
||||
use rust_nex::common::setup;
|
||||
use rust_nex::reggie::{get_configured_tls_acceptor, TestStruct, ROOT_TRUST_ANCHOR, SELF_CERT, SELF_KEY};
|
||||
use std::borrow::ToOwned;
|
||||
use std::fs;
|
||||
use std::io::Cursor;
|
||||
|
|
@ -21,10 +21,10 @@ use tokio::io::AsyncReadExt;
|
|||
use tokio::net::{TcpListener, TcpSocket};
|
||||
use tokio::task;
|
||||
use tokio_rustls::TlsAcceptor;
|
||||
use splatoon_server_rust::define_rmc_proto;
|
||||
use splatoon_server_rust::rmc::protocols::new_rmc_gateway_connection;
|
||||
use splatoon_server_rust::rmc::response::ErrorCode;
|
||||
use splatoon_server_rust::rmc::structures::RmcSerialize;
|
||||
use rust_nex::define_rmc_proto;
|
||||
use rust_nex::rmc::protocols::new_rmc_gateway_connection;
|
||||
use rust_nex::rmc::response::ErrorCode;
|
||||
use rust_nex::rmc::structures::RmcSerialize;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ use rsa::signature::{RandomizedSigner, SignatureEncoding};
|
|||
use sha2::Sha256;
|
||||
use tokio::net::TcpSocket;
|
||||
use tokio::task;
|
||||
use splatoon_server_rust::common::setup;
|
||||
use splatoon_server_rust::prudp::packet::VirtualPort;
|
||||
use splatoon_server_rust::prudp::router::Router;
|
||||
use splatoon_server_rust::prudp::unsecure::Unsecure;
|
||||
use splatoon_server_rust::reggie::{establish_tls_connection_to, UnitPacketRead, UnitPacketWrite};
|
||||
use splatoon_server_rust::rmc::structures::RmcSerialize;
|
||||
use splatoon_server_rust::rnex_proxy_common::ConnectionInitData;
|
||||
use rust_nex::common::setup;
|
||||
use rust_nex::prudp::packet::VirtualPort;
|
||||
use rust_nex::prudp::router::Router;
|
||||
use rust_nex::prudp::unsecure::Unsecure;
|
||||
use rust_nex::reggie::{establish_tls_connection_to, UnitPacketRead, UnitPacketWrite};
|
||||
use rust_nex::rmc::structures::RmcSerialize;
|
||||
use rust_nex::rnex_proxy_common::ConnectionInitData;
|
||||
|
||||
static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
||||
env::var("SERVER_IP")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
extern crate self as splatoon_server_rust;
|
||||
extern crate self as rust_nex;
|
||||
|
||||
pub mod endianness;
|
||||
pub mod prudp;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
//! also the first and only current usage of rnex, expect this and rnex to be split into seperate
|
||||
//! repos soon.
|
||||
|
||||
extern crate self as splatoon_server_rust;
|
||||
extern crate self as rust_nex;
|
||||
|
||||
use crate::nex::account::Account;
|
||||
use crate::nex::auth_handler::{AuthHandler, RemoteAuthClientProtocol};
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ macro_rules! define_rmc_proto {
|
|||
}) => {
|
||||
paste::paste!{
|
||||
pub trait [<Local $name>]: std::any::Any $( + [<Raw $protocol>] + $protocol)* {
|
||||
async fn rmc_call(&self, remote_response_connection: &splatoon_server_rust::util::SendingBufferConnection, protocol_id: u16, method_id: u32, call_id: u32, rest: Vec<u8>){
|
||||
async fn rmc_call(&self, remote_response_connection: &rust_nex::util::SendingBufferConnection, protocol_id: u16, method_id: u32, call_id: u32, rest: Vec<u8>){
|
||||
match protocol_id{
|
||||
$(
|
||||
[<Raw $protocol Info>]::PROTOCOL_ID => <Self as [<Raw $protocol>]>::rmc_call_proto(self, remote_response_connection, method_id, call_id, rest).await,
|
||||
|
|
@ -167,16 +167,16 @@ macro_rules! define_rmc_proto {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct [<Remote $name>](splatoon_server_rust::rmc::protocols::RmcConnection);
|
||||
pub struct [<Remote $name>](rust_nex::rmc::protocols::RmcConnection);
|
||||
|
||||
impl splatoon_server_rust::rmc::protocols::RemoteInstantiatable for [<Remote $name>]{
|
||||
fn new(conn: splatoon_server_rust::rmc::protocols::RmcConnection) -> Self{
|
||||
impl rust_nex::rmc::protocols::RemoteInstantiatable for [<Remote $name>]{
|
||||
fn new(conn: rust_nex::rmc::protocols::RmcConnection) -> Self{
|
||||
Self(conn)
|
||||
}
|
||||
}
|
||||
|
||||
impl splatoon_server_rust::rmc::protocols::HasRmcConnection for [<Remote $name>]{
|
||||
fn get_connection(&self) -> &splatoon_server_rust::rmc::protocols::RmcConnection{
|
||||
impl rust_nex::rmc::protocols::HasRmcConnection for [<Remote $name>]{
|
||||
fn get_connection(&self) -> &rust_nex::rmc::protocols::RmcConnection{
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use log::error;
|
|||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
||||
use tokio::task;
|
||||
use splatoon_server_rust::reggie::{UnitPacketRead, UnitPacketWrite};
|
||||
use rust_nex::reggie::{UnitPacketRead, UnitPacketWrite};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SendingBufferConnection(Sender<Vec<u8>>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue