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",
|
"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]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.25"
|
version = "0.1.25"
|
||||||
|
|
@ -2483,48 +2525,6 @@ dependencies = [
|
||||||
"der",
|
"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]]
|
[[package]]
|
||||||
name = "stable-pattern"
|
name = "stable-pattern"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "splatoon-server-rust"
|
name = "rust-nex"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#pre_inner
|
#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
|
#serialize_base_content
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#pre_inner
|
#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
|
#deserialize_base_content
|
||||||
})?)
|
})?)
|
||||||
}
|
}
|
||||||
|
|
@ -229,14 +229,14 @@ pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
||||||
let ident = derive_input.ident;
|
let ident = derive_input.ident;
|
||||||
|
|
||||||
let tokens = quote! {
|
let tokens = quote! {
|
||||||
impl splatoon_server_rust::rmc::structures::RmcSerialize for #ident{
|
impl rust_nex::rmc::structures::RmcSerialize for #ident{
|
||||||
fn serialize(&self, writer: &mut dyn ::std::io::Write) -> splatoon_server_rust::rmc::structures::Result<()>{
|
fn serialize(&self, writer: &mut dyn ::std::io::Write) -> rust_nex::rmc::structures::Result<()>{
|
||||||
#serialize_base_content
|
#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
|
#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{
|
impl rust_nex::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>){
|
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;
|
<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{
|
for (param_name, param_type) in parameters{
|
||||||
quote!{
|
quote!{
|
||||||
let Ok(#param_name) =
|
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
|
&mut cursor
|
||||||
) else
|
) else
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
|
|
@ -84,7 +84,7 @@ impl RmcProtocolData{
|
||||||
quote! {
|
quote! {
|
||||||
{
|
{
|
||||||
log::error!(#error_msg);
|
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)
|
}.to_tokens(tokens)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -116,7 +116,7 @@ impl RmcProtocolData{
|
||||||
quote!{
|
quote!{
|
||||||
let retval = retval?;
|
let retval = retval?;
|
||||||
let mut vec = Vec::new();
|
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)
|
Ok(vec)
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +126,7 @@ impl RmcProtocolData{
|
||||||
quote!{
|
quote!{
|
||||||
async fn rmc_call_proto(
|
async fn rmc_call_proto(
|
||||||
&self,
|
&self,
|
||||||
remote_response_connection: &splatoon_server_rust::util::SendingBufferConnection,
|
remote_response_connection: &rust_nex::util::SendingBufferConnection,
|
||||||
method_id: u32,
|
method_id: u32,
|
||||||
call_id: u32,
|
call_id: u32,
|
||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
|
|
@ -165,7 +165,7 @@ impl RmcProtocolData{
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
if self.has_returns {
|
if self.has_returns {
|
||||||
quote! {
|
quote! {
|
||||||
Err(splatoon_server_rust::rmc::response::ErrorCode::Core_NotImplemented)
|
Err(rust_nex::rmc::response::ErrorCode::Core_NotImplemented)
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -176,7 +176,7 @@ impl RmcProtocolData{
|
||||||
|
|
||||||
if *has_returns{
|
if *has_returns{
|
||||||
quote!{
|
quote!{
|
||||||
splatoon_server_rust::rmc::response::send_result(
|
rust_nex::rmc::response::send_result(
|
||||||
remote_response_connection,
|
remote_response_connection,
|
||||||
ret,
|
ret,
|
||||||
#id,
|
#id,
|
||||||
|
|
@ -209,7 +209,7 @@ impl RmcProtocolData{
|
||||||
// boilerplate tokens which all raw traits need
|
// boilerplate tokens which all raw traits need
|
||||||
quote!{
|
quote!{
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub trait #remote_name: splatoon_server_rust::rmc::protocols::HasRmcConnection
|
pub trait #remote_name: rust_nex::rmc::protocols::HasRmcConnection
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
|
|
||||||
// generate the body of the raw protocol trait
|
// generate the body of the raw protocol trait
|
||||||
|
|
@ -247,12 +247,12 @@ impl RmcProtocolData{
|
||||||
|
|
||||||
for (param_name, param_type) in parameters{
|
for (param_name, param_type) in parameters{
|
||||||
quote!{
|
quote!{
|
||||||
splatoon_server_rust::result::ResultExtension::display_err_or_some(
|
rust_nex::result::ResultExtension::display_err_or_some(
|
||||||
<#param_type as splatoon_server_rust::rmc::structures::RmcSerialize>::serialize(
|
<#param_type as rust_nex::rmc::structures::RmcSerialize>::serialize(
|
||||||
&#param_name,
|
&#param_name,
|
||||||
&mut cursor
|
&mut cursor
|
||||||
)
|
)
|
||||||
).ok_or(splatoon_server_rust::rmc::response::ErrorCode::Core_InvalidArgument)
|
).ok_or(rust_nex::rmc::response::ErrorCode::Core_InvalidArgument)
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
if self.has_returns {
|
if self.has_returns {
|
||||||
quote! {
|
quote! {
|
||||||
|
|
@ -268,25 +268,25 @@ impl RmcProtocolData{
|
||||||
quote!{
|
quote!{
|
||||||
let call_id = rand::random();
|
let call_id = rand::random();
|
||||||
|
|
||||||
let message = splatoon_server_rust::rmc::message::RMCMessage{
|
let message = rust_nex::rmc::message::RMCMessage{
|
||||||
call_id,
|
call_id,
|
||||||
method_id: #method_id,
|
method_id: #method_id,
|
||||||
protocol_id: #proto_id,
|
protocol_id: #proto_id,
|
||||||
rest_of_data: send_data
|
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);
|
}.to_tokens(tokens);
|
||||||
|
|
||||||
if *has_returns{
|
if *has_returns{
|
||||||
quote!{
|
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
|
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);
|
}.to_tokens(tokens);
|
||||||
} else {
|
} else {
|
||||||
quote!{
|
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
|
rmc_conn.make_raw_call_no_response(&message).await
|
||||||
);
|
);
|
||||||
}.to_tokens(tokens);
|
}.to_tokens(tokens);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ use rustls::{
|
||||||
SignatureScheme,
|
SignatureScheme,
|
||||||
};
|
};
|
||||||
use rustls_pki_types::PrivateKeyDer;
|
use rustls_pki_types::PrivateKeyDer;
|
||||||
use splatoon_server_rust::common::setup;
|
use rust_nex::common::setup;
|
||||||
use splatoon_server_rust::reggie::{get_configured_tls_acceptor, TestStruct, ROOT_TRUST_ANCHOR, SELF_CERT, SELF_KEY};
|
use rust_nex::reggie::{get_configured_tls_acceptor, TestStruct, ROOT_TRUST_ANCHOR, SELF_CERT, SELF_KEY};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
@ -21,10 +21,10 @@ use tokio::io::AsyncReadExt;
|
||||||
use tokio::net::{TcpListener, TcpSocket};
|
use tokio::net::{TcpListener, TcpSocket};
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
use tokio_rustls::TlsAcceptor;
|
use tokio_rustls::TlsAcceptor;
|
||||||
use splatoon_server_rust::define_rmc_proto;
|
use rust_nex::define_rmc_proto;
|
||||||
use splatoon_server_rust::rmc::protocols::new_rmc_gateway_connection;
|
use rust_nex::rmc::protocols::new_rmc_gateway_connection;
|
||||||
use splatoon_server_rust::rmc::response::ErrorCode;
|
use rust_nex::rmc::response::ErrorCode;
|
||||||
use splatoon_server_rust::rmc::structures::RmcSerialize;
|
use rust_nex::rmc::structures::RmcSerialize;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@ use rsa::signature::{RandomizedSigner, SignatureEncoding};
|
||||||
use sha2::Sha256;
|
use sha2::Sha256;
|
||||||
use tokio::net::TcpSocket;
|
use tokio::net::TcpSocket;
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
use splatoon_server_rust::common::setup;
|
use rust_nex::common::setup;
|
||||||
use splatoon_server_rust::prudp::packet::VirtualPort;
|
use rust_nex::prudp::packet::VirtualPort;
|
||||||
use splatoon_server_rust::prudp::router::Router;
|
use rust_nex::prudp::router::Router;
|
||||||
use splatoon_server_rust::prudp::unsecure::Unsecure;
|
use rust_nex::prudp::unsecure::Unsecure;
|
||||||
use splatoon_server_rust::reggie::{establish_tls_connection_to, UnitPacketRead, UnitPacketWrite};
|
use rust_nex::reggie::{establish_tls_connection_to, UnitPacketRead, UnitPacketWrite};
|
||||||
use splatoon_server_rust::rmc::structures::RmcSerialize;
|
use rust_nex::rmc::structures::RmcSerialize;
|
||||||
use splatoon_server_rust::rnex_proxy_common::ConnectionInitData;
|
use rust_nex::rnex_proxy_common::ConnectionInitData;
|
||||||
|
|
||||||
static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
||||||
env::var("SERVER_IP")
|
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 endianness;
|
||||||
pub mod prudp;
|
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
|
//! also the first and only current usage of rnex, expect this and rnex to be split into seperate
|
||||||
//! repos soon.
|
//! repos soon.
|
||||||
|
|
||||||
extern crate self as splatoon_server_rust;
|
extern crate self as rust_nex;
|
||||||
|
|
||||||
use crate::nex::account::Account;
|
use crate::nex::account::Account;
|
||||||
use crate::nex::auth_handler::{AuthHandler, RemoteAuthClientProtocol};
|
use crate::nex::auth_handler::{AuthHandler, RemoteAuthClientProtocol};
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ macro_rules! define_rmc_proto {
|
||||||
}) => {
|
}) => {
|
||||||
paste::paste!{
|
paste::paste!{
|
||||||
pub trait [<Local $name>]: std::any::Any $( + [<Raw $protocol>] + $protocol)* {
|
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{
|
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,
|
[<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>]{
|
impl rust_nex::rmc::protocols::RemoteInstantiatable for [<Remote $name>]{
|
||||||
fn new(conn: splatoon_server_rust::rmc::protocols::RmcConnection) -> Self{
|
fn new(conn: rust_nex::rmc::protocols::RmcConnection) -> Self{
|
||||||
Self(conn)
|
Self(conn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl splatoon_server_rust::rmc::protocols::HasRmcConnection for [<Remote $name>]{
|
impl rust_nex::rmc::protocols::HasRmcConnection for [<Remote $name>]{
|
||||||
fn get_connection(&self) -> &splatoon_server_rust::rmc::protocols::RmcConnection{
|
fn get_connection(&self) -> &rust_nex::rmc::protocols::RmcConnection{
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use log::error;
|
||||||
use tokio::io::{AsyncRead, AsyncWrite};
|
use tokio::io::{AsyncRead, AsyncWrite};
|
||||||
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
use splatoon_server_rust::reggie::{UnitPacketRead, UnitPacketWrite};
|
use rust_nex::reggie::{UnitPacketRead, UnitPacketWrite};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SendingBufferConnection(Sender<Vec<u8>>);
|
pub struct SendingBufferConnection(Sender<Vec<u8>>);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue