progress
Some checks failed
Build and Test / friends (push) Successful in 9m35s
Build and Test / wii-u-chat (push) Has been cancelled
Build and Test / puyopuyo (push) Has been cancelled
Build and Test / sonic-transformed (push) Has been cancelled
Build and Test / super-mario-maker (push) Has been cancelled
Build and Test / minecraft-wiiu (push) Has been cancelled
Build and Test / wii-sports-club (push) Has been cancelled
Build and Test / splatoon (push) Has been cancelled
Build and Test / splatoon-testfire (push) Has been cancelled
Build and Test / fast-racing-neo (push) Has been cancelled
Build and Test / mario-tennis (push) Has been cancelled
Some checks failed
Build and Test / friends (push) Successful in 9m35s
Build and Test / wii-u-chat (push) Has been cancelled
Build and Test / puyopuyo (push) Has been cancelled
Build and Test / sonic-transformed (push) Has been cancelled
Build and Test / super-mario-maker (push) Has been cancelled
Build and Test / minecraft-wiiu (push) Has been cancelled
Build and Test / wii-sports-club (push) Has been cancelled
Build and Test / splatoon (push) Has been cancelled
Build and Test / splatoon-testfire (push) Has been cancelled
Build and Test / fast-racing-neo (push) Has been cancelled
Build and Test / mario-tennis (push) Has been cancelled
This commit is contained in:
parent
8db02c00ec
commit
47f7dea859
27 changed files with 160 additions and 170 deletions
112
Cargo.lock
generated
112
Cargo.lock
generated
|
|
@ -171,7 +171,7 @@ version = "0.9.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1fc76eaeac4c9164506c466d4ffdd8ec9d0c5bf57ee97177c4d8eceb3a0e138"
|
||||
dependencies = [
|
||||
"cipher 0.5.1",
|
||||
"cipher",
|
||||
"cpubits",
|
||||
"cpufeatures 0.3.0",
|
||||
]
|
||||
|
|
@ -447,16 +447,6 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||
dependencies = [
|
||||
"crypto-common 0.1.7",
|
||||
"inout 0.1.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.5.1"
|
||||
|
|
@ -465,7 +455,7 @@ checksum = "e34d8227fe1ba289043aeb13792056ff80fd6de1a9f49137a5f499de8e8c78ea"
|
|||
dependencies = [
|
||||
"block-buffer 0.12.0",
|
||||
"crypto-common 0.2.1",
|
||||
"inout 0.2.2",
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -704,7 +694,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
|||
dependencies = [
|
||||
"block-buffer 0.10.4",
|
||||
"crypto-common 0.1.7",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1133,16 +1122,7 @@ version = "0.13.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018"
|
||||
dependencies = [
|
||||
"hmac 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||
dependencies = [
|
||||
"digest 0.10.7",
|
||||
"hmac",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1471,15 +1451,6 @@ dependencies = [
|
|||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.2.2"
|
||||
|
|
@ -1623,16 +1594,6 @@ version = "0.8.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.11.0"
|
||||
|
|
@ -1708,9 +1669,9 @@ checksum = "6f1cfe935e71c764dfd6bad9b23372396f785408536c0a23fba379ef405117d3"
|
|||
dependencies = [
|
||||
"base64",
|
||||
"bytemuck",
|
||||
"hmac 0.13.0",
|
||||
"hmac",
|
||||
"log",
|
||||
"md-5 0.11.0",
|
||||
"md-5",
|
||||
"prost",
|
||||
"simplelog",
|
||||
"spbr-common",
|
||||
|
|
@ -2206,7 +2167,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"proxy-common",
|
||||
"prudpv0",
|
||||
"prudpv1",
|
||||
"prudpv1-proxy",
|
||||
"rnex-prudp",
|
||||
"rnex-server",
|
||||
"tokio",
|
||||
|
|
@ -2234,10 +2195,10 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"hmac 0.13.0",
|
||||
"md-5 0.11.0",
|
||||
"hmac",
|
||||
"md-5",
|
||||
"proxy-common",
|
||||
"rc4 0.2.0",
|
||||
"rc4",
|
||||
"rnex-prudp",
|
||||
"rnex-rmc",
|
||||
"rnex-util",
|
||||
|
|
@ -2253,19 +2214,32 @@ dependencies = [
|
|||
"async-trait",
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"hmac 0.12.1",
|
||||
"md-5 0.10.6",
|
||||
"once_cell",
|
||||
"hmac",
|
||||
"md-5",
|
||||
"proxy-common",
|
||||
"rc4 0.1.0",
|
||||
"rc4",
|
||||
"rnex-prudp",
|
||||
"rnex-util",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"typenum",
|
||||
"v-byte-helpers",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prudpv1-proxy"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proxy-common",
|
||||
"prudpv1",
|
||||
"rnex-prudp",
|
||||
"rnex-server",
|
||||
"rnex-util",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.13.4"
|
||||
|
|
@ -2353,22 +2327,13 @@ version = "0.10.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "rc4"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f1256e23efe6097f27aa82d6ca6889361c001586ae0f6917cbad072f05eb275"
|
||||
dependencies = [
|
||||
"cipher 0.4.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rc4"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "840038b674daa9f7a7957440d937951d15c0143c056e631e529141fd780e0c92"
|
||||
dependencies = [
|
||||
"cipher 0.5.1",
|
||||
"cipher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2527,7 +2492,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"futures",
|
||||
"hex",
|
||||
"hmac 0.13.0",
|
||||
"hmac",
|
||||
"rnex-base",
|
||||
"rnex-base-protos",
|
||||
"rnex-ds-protos",
|
||||
|
|
@ -2558,8 +2523,8 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"chrono",
|
||||
"hex",
|
||||
"hmac 0.13.0",
|
||||
"md-5 0.11.0",
|
||||
"hmac",
|
||||
"md-5",
|
||||
"nex-account",
|
||||
"rand 0.10.2",
|
||||
"rnex-base",
|
||||
|
|
@ -2608,6 +2573,7 @@ dependencies = [
|
|||
"ctor",
|
||||
"rnex-base-protos",
|
||||
"rnex-rmc",
|
||||
"rnex-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2644,10 +2610,10 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"hmac 0.13.0",
|
||||
"md-5 0.11.0",
|
||||
"hmac",
|
||||
"md-5",
|
||||
"rand 0.10.2",
|
||||
"rc4 0.2.0",
|
||||
"rc4",
|
||||
"rnex-util",
|
||||
"tracing",
|
||||
"typenum",
|
||||
|
|
@ -2744,7 +2710,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
"md-5 0.11.0",
|
||||
"md-5",
|
||||
"nex-account",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
|
|
@ -3166,9 +3132,9 @@ dependencies = [
|
|||
"aes",
|
||||
"base64",
|
||||
"bytemuck",
|
||||
"hmac 0.13.0",
|
||||
"hmac",
|
||||
"hybrid-array",
|
||||
"md-5 0.11.0",
|
||||
"md-5",
|
||||
"rand 0.10.2",
|
||||
"thiserror",
|
||||
]
|
||||
|
|
@ -3315,10 +3281,10 @@ dependencies = [
|
|||
"futures-util",
|
||||
"hex",
|
||||
"hkdf",
|
||||
"hmac 0.13.0",
|
||||
"hmac",
|
||||
"itoa",
|
||||
"log",
|
||||
"md-5 0.11.0",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"rand 0.10.2",
|
||||
"serde",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ members = [
|
|||
"rnex-server-nex-modules/rnex-base",
|
||||
"rnex-server-nex-modules/rnex-msg",
|
||||
"rnex-server-nex-modules/rnex-auth"
|
||||
]
|
||||
, "prudpv1-proxy"]
|
||||
|
||||
|
||||
[workspace.lints.clippy]
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ echo CHECKING $EDITION
|
|||
echo FEATURES:
|
||||
echo $EDITION_FEATURES
|
||||
|
||||
#RUSTFLAGS="--deny warnings" cargo clippy --workspace --features "$EDITION_FEATURES"
|
||||
# cargo check --workspace --features "$EDITION_FEATURES"
|
||||
# RUSTFLAGS="--deny warnings" cargo clippy --workspace --features "$EDITION_FEATURES"
|
||||
# RUSTFLAGS="--deny warnings" cargo check --workspace --features "$EDITION_FEATURES"
|
||||
echo "edition checks are disabled right now due to being in"
|
||||
|
|
|
|||
|
|
@ -176,7 +176,8 @@ pub async fn setup_edge_node_connection(
|
|||
r,
|
||||
shutdown_callback,
|
||||
))
|
||||
});
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
pub async fn new_backend_connection(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ workspace = true
|
|||
[dependencies]
|
||||
tokio = { version = "1.47.0", features = ["full"] }
|
||||
prudpv0 = { path = "../prudpv0", optional = true }
|
||||
prudpv1 = { path = "../prudpv1", optional = true }
|
||||
prudpv1-proxy = { path = "../prudpv1-proxy", optional = true }
|
||||
proxy-common = { path = "../proxy-common" }
|
||||
cfg-if = "1.0.4"
|
||||
rnex-prudp = { path = "../rnex-prudp" }
|
||||
|
|
@ -18,7 +18,8 @@ tracing = "0.1.44"
|
|||
|
||||
[features]
|
||||
prudpv0 = ["dep:prudpv0"]
|
||||
prudpv1 = ["dep:prudpv1"]
|
||||
prudpv1 = ["dep:prudpv1-proxy"]
|
||||
prudplite = []
|
||||
friends = ["prudpv0", "prudpv0/friends"]
|
||||
splatoon = ["prudpv1"]
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ cfg_if! {
|
|||
if #[cfg(feature = "prudpv0")]{
|
||||
pub use prudpv0::*;
|
||||
} else if #[cfg(feature = "prudpv1")] {
|
||||
pub use prudpv1::*;
|
||||
pub use prudpv1_proxy::*;
|
||||
} else if #[cfg(feature = "prudplite")]{
|
||||
pub use prudplite::*;
|
||||
} else {
|
||||
|
|
|
|||
19
prudpv1-proxy/Cargo.toml
Normal file
19
prudpv1-proxy/Cargo.toml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "prudpv1-proxy"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
prudpv1 = {path = "../prudpv1"}
|
||||
proxy-common = {path = "../proxy-common"}
|
||||
rnex-server = {path = "../rnex-server"}
|
||||
rnex-prudp = {path = "../rnex-prudp"}
|
||||
rnex-util = {path = "../rnex-util"}
|
||||
tracing = "0.1.44"
|
||||
tokio = { version = "1.52.3", features = ["rt"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
prudpv1 = []
|
||||
13
prudpv1-proxy/src/lib.rs
Normal file
13
prudpv1-proxy/src/lib.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#![cfg(feature = "prudpv1")]
|
||||
use proxy_common::ProxyStartupParam;
|
||||
|
||||
pub mod proxy_insecure;
|
||||
pub mod proxy_secure;
|
||||
|
||||
pub async fn start_secure(param: ProxyStartupParam) {
|
||||
proxy_secure::start(param).await;
|
||||
}
|
||||
|
||||
pub async fn start_insecure(param: ProxyStartupParam) {
|
||||
proxy_insecure::start(param).await;
|
||||
}
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
use crate::prudp::router::Router;
|
||||
use crate::prudp::unsecure::Unsecure;
|
||||
use tracing::error;
|
||||
use tracing::warn;
|
||||
use proxy_common::{ProxyStartupParam, RNEX_ACCESS_KEY};
|
||||
use rnex_core::executables::common::SECURE_SERVER_ACCOUNT;
|
||||
use prudpv1::prudp::router::Router;
|
||||
use prudpv1::prudp::unsecure::Unsecure;
|
||||
use rnex_prudp::virtual_port::VirtualPort;
|
||||
use rnex_util::{UnitPacketRead, UnitPacketWrite};
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_server::ConnectionInitData;
|
||||
use rnex_util::{UnitPacketRead, UnitPacketWrite};
|
||||
use rnex_server::rmc::serialization::RmcSerialize;
|
||||
use rnex_util::UnitPacketRead;
|
||||
use rnex_util::UnitPacketWrite;
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::task;
|
||||
use tokio::time::sleep;
|
||||
use tracing::error;
|
||||
|
||||
pub async fn start(param: ProxyStartupParam) {
|
||||
let (router_secure, _) = Router::new(param.self_private)
|
||||
|
|
@ -42,7 +40,7 @@ pub async fn start(param: ProxyStartupParam) {
|
|||
if let Err(e) = stream
|
||||
.send_buffer(
|
||||
&ConnectionInitData {
|
||||
prudpsock_addr: conn.socket_addr,
|
||||
addr: conn.socket_addr.regular_socket_addr,
|
||||
pid: conn.user_id,
|
||||
}
|
||||
.to_data()
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
use crate::prudp::router::Router;
|
||||
use crate::prudp::secure::Secure;
|
||||
use tracing::error;
|
||||
use tracing::warn;
|
||||
use proxy_common::{ProxyStartupParam, RNEX_ACCESS_KEY};
|
||||
use rnex_core::executables::common::SECURE_SERVER_ACCOUNT;
|
||||
use prudpv1::prudp::{router::Router, secure::Secure};
|
||||
use rnex_prudp::virtual_port::VirtualPort;
|
||||
use rnex_util::{UnitPacketRead, UnitPacketWrite};
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_server::ConnectionInitData;
|
||||
use rnex_server::rmc::serialization::RmcSerialize;
|
||||
use rnex_util::account::Account;
|
||||
use rnex_util::{UnitPacketRead, UnitPacketWrite};
|
||||
use std::ops::Deref;
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::task;
|
||||
use tokio::time::sleep;
|
||||
use tracing::error;
|
||||
|
||||
pub async fn start(param: ProxyStartupParam) {
|
||||
let (router_secure, _) = Router::new(param.self_private)
|
||||
|
|
@ -23,7 +20,12 @@ pub async fn start(param: ProxyStartupParam) {
|
|||
let mut socket_secure = router_secure
|
||||
.add_socket(
|
||||
VirtualPort::new(1, 10),
|
||||
Secure(RNEX_ACCESS_KEY, SECURE_SERVER_ACCOUNT.clone()),
|
||||
Secure(
|
||||
RNEX_ACCESS_KEY,
|
||||
Account::from_nexact(2, "Quazal Rendez-Vous")
|
||||
.await
|
||||
.expect("failed to get account"),
|
||||
),
|
||||
)
|
||||
.await
|
||||
.expect("unable to add socket");
|
||||
|
|
@ -35,6 +37,8 @@ pub async fn start(param: ProxyStartupParam) {
|
|||
};
|
||||
|
||||
task::spawn(async move {
|
||||
// todo: add support for checking this to nex-account
|
||||
/*
|
||||
let Ok(mut c) = rnex_core::grpc::account::Client::new().await else {
|
||||
error!("failed to initialize gql client");
|
||||
return;
|
||||
|
|
@ -51,7 +55,7 @@ pub async fn start(param: ProxyStartupParam) {
|
|||
if v < 0 {
|
||||
warn!("person with too low account level joined");
|
||||
return;
|
||||
}
|
||||
} */
|
||||
|
||||
let mut stream = match TcpStream::connect(param.forward_destination).await {
|
||||
Ok(v) => v,
|
||||
|
|
@ -64,7 +68,7 @@ pub async fn start(param: ProxyStartupParam) {
|
|||
if let Err(e) = stream
|
||||
.send_buffer(
|
||||
&ConnectionInitData {
|
||||
prudpsock_addr: conn.socket_addr,
|
||||
addr: conn.socket_addr.regular_socket_addr,
|
||||
pid: conn.user_id,
|
||||
}
|
||||
.to_data()
|
||||
|
|
@ -7,21 +7,21 @@ edition = "2024"
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
|
||||
bytemuck = { version = "1.23.1", features = ["derive"] }
|
||||
tokio = { version = "1.47.0", features = ["full"] }
|
||||
hmac = "0.12.1"
|
||||
md-5 = "^0.10.6"
|
||||
rc4 = "0.1.0"
|
||||
hmac = "0.13.0"
|
||||
md-5 = "0.11.0"
|
||||
rc4 = "0.2.0"
|
||||
v-byte-helpers = { git = "https://github.com/RusticMaple/VByteMacros", version = "0.1.1" }
|
||||
thiserror = "2.0.12"
|
||||
async-trait = "0.1.88"
|
||||
typenum = "1.18.0"
|
||||
once_cell = "1.21.3"
|
||||
# once_cell = "1.21.3"
|
||||
rnex-prudp = { path = "../rnex-prudp" }
|
||||
rnex-util = { path = "../rnex-util" }
|
||||
proxy-common = {path = "../proxy-common"}
|
||||
cfg-if = "1.0.4"
|
||||
tracing = "0.1.44"
|
||||
|
||||
[features]
|
||||
prudpv1 = []
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
pub mod proxy_insecure;
|
||||
pub mod proxy_secure;
|
||||
|
|
@ -1,14 +1,5 @@
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "prudpv1")]{
|
||||
use proxy_common::ProxyStartupParam;
|
||||
pub mod executables;
|
||||
pub mod prudp;
|
||||
pub async fn start_secure(param: ProxyStartupParam) {
|
||||
executables::proxy_secure::start(param).await;
|
||||
}
|
||||
|
||||
pub async fn start_insecure(param: ProxyStartupParam) {
|
||||
executables::proxy_insecure::start(param).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ use crate::prudp::packet::PacketOption::{
|
|||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use hmac::{Hmac, Mac};
|
||||
use tracing::{error, warn};
|
||||
use md5::{Digest, Md5};
|
||||
use rc4::KeyInit;
|
||||
use rnex_prudp::socket_addr::PRUDPSockAddr;
|
||||
use rnex_prudp::types_flags::TypesFlags;
|
||||
use rnex_prudp::types_flags::flags::ACK;
|
||||
|
|
@ -20,6 +20,7 @@ use std::io::{Cursor, Read, Seek, Write};
|
|||
use std::net::SocketAddr;
|
||||
use std::net::SocketAddrV4;
|
||||
use thiserror::Error;
|
||||
use tracing::{error, warn};
|
||||
use v_byte_helpers::SwapEndian;
|
||||
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
|
||||
|
||||
|
|
@ -320,24 +321,17 @@ impl PRUDPV1Packet {
|
|||
|
||||
let mut hmac = Md5Hmac::new_from_slice(&key).expect("fuck");
|
||||
|
||||
hmac.write(&header_data)
|
||||
.expect("error during hmac calculation");
|
||||
hmac.update(&header_data);
|
||||
if let Some(session_key) = session_key {
|
||||
hmac.write(&session_key)
|
||||
.expect("error during hmac calculation");
|
||||
hmac.update(&session_key);
|
||||
}
|
||||
hmac.write(&access_key_sum_bytes)
|
||||
.expect("error during hmac calculation");
|
||||
hmac.update(&access_key_sum_bytes);
|
||||
if let Some(connection_signature) = connection_signature {
|
||||
hmac.write(&connection_signature)
|
||||
.expect("error during hmac calculation");
|
||||
hmac.update(&connection_signature);
|
||||
}
|
||||
|
||||
hmac.write(&option_bytes)
|
||||
.expect("error during hmac calculation");
|
||||
|
||||
hmac.write_all(&self.payload)
|
||||
.expect("error during hmac calculation");
|
||||
hmac.update(&option_bytes);
|
||||
hmac.update(&self.payload);
|
||||
|
||||
hmac.finalize().into_bytes()[0..16]
|
||||
.try_into()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
use crate::prudp::packet::PRUDPV1Packet;
|
||||
use crate::prudp::socket::{CryptoHandler, CryptoHandlerConnectionInstance};
|
||||
use hmac::digest::consts::U32;
|
||||
use rc4::cipher::StreamCipherCoreWrapper;
|
||||
use rc4::{KeyInit, Rc4, Rc4Core, StreamCipher};
|
||||
use typenum::U5;
|
||||
use rnex_util::PID;
|
||||
use rc4::{KeyInit, Rc4, StreamCipher};
|
||||
use rnex_prudp::encryption::EncryptionPair;
|
||||
use rnex_prudp::ticket::read_secure_connection_data;
|
||||
use serde_core::ser::Serialize;
|
||||
use rnex_util::PID;
|
||||
use rnex_util::account::Account;
|
||||
|
||||
type Rc4U32 = StreamCipherCoreWrapper<Rc4Core<U32>>;
|
||||
//type Rc4U32 = StreamCipherCoreWrapper<Rc4Core<U32>>;
|
||||
|
||||
pub fn generate_secure_encryption_pairs(
|
||||
mut session_key: [u8; 32],
|
||||
count: u8,
|
||||
) -> Vec<EncryptionPair<Rc4<U32>>> {
|
||||
) -> Vec<EncryptionPair<Rc4>> {
|
||||
let mut vec = Vec::with_capacity(count as usize);
|
||||
|
||||
vec.push(EncryptionPair {
|
||||
send: Rc4U32::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
recv: Rc4U32::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
send: Rc4::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
recv: Rc4::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
});
|
||||
|
||||
for _ in 1..=count {
|
||||
|
|
@ -31,8 +29,8 @@ pub fn generate_secure_encryption_pairs(
|
|||
}
|
||||
|
||||
vec.push(EncryptionPair {
|
||||
send: Rc4U32::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
recv: Rc4U32::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
send: Rc4::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
recv: Rc4::new_from_slice(&session_key).expect("unable to create rc4"),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +42,7 @@ pub struct Secure(pub &'static str, pub Account);
|
|||
pub struct SecureInstance {
|
||||
access_key: &'static str,
|
||||
session_key: [u8; 32],
|
||||
streams: Vec<EncryptionPair<Rc4<U32>>>,
|
||||
streams: Vec<EncryptionPair<Rc4>>,
|
||||
self_signature: [u8; 16],
|
||||
#[allow(dead_code)]
|
||||
remote_signature: [u8; 16],
|
||||
|
|
@ -69,7 +67,10 @@ impl CryptoHandler for Secure {
|
|||
|
||||
let mut response = Vec::new();
|
||||
|
||||
data.serialize(&mut response).ok()?;
|
||||
response.extend_from_slice(&(response.len() as u32).to_le_bytes());
|
||||
response.extend_from_slice(&data[..]);
|
||||
|
||||
//data.serialize(&mut response).ok()?;
|
||||
|
||||
let encryption_pairs = generate_secure_encryption_pairs(session_key, substream_count);
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ impl CryptoHandler for Secure {
|
|||
}
|
||||
|
||||
impl CryptoHandlerConnectionInstance for SecureInstance {
|
||||
type Encryption = Rc4<U5>;
|
||||
type Encryption = Rc4;
|
||||
|
||||
fn decrypt_incoming(&mut self, substream: u8, data: &mut [u8]) {
|
||||
if let Some(crypt_pair) = self.streams.get_mut(substream as usize) {
|
||||
|
|
|
|||
|
|
@ -3,24 +3,23 @@ use crate::prudp::packet::PacketOption::{
|
|||
};
|
||||
use crate::prudp::packet::{PRUDPV1Header, PRUDPV1Packet};
|
||||
use async_trait::async_trait;
|
||||
use tracing::error;
|
||||
use tracing::{info, warn};
|
||||
use rc4::StreamCipher;
|
||||
use rnex_prudp::socket_addr::PRUDPSockAddr;
|
||||
use rnex_prudp::types_flags::TypesFlags;
|
||||
use rnex_prudp::types_flags::flags::{ACK, HAS_SIZE, MULTI_ACK, NEED_ACK, RELIABLE};
|
||||
use rnex_prudp::types_flags::types::{CONNECT, DATA, DISCONNECT, PING, SYN};
|
||||
use rnex_prudp::virtual_port::VirtualPort;
|
||||
use rnex_util::PID;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::io::Cursor;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Arc, Weak};
|
||||
use tokio::spawn;
|
||||
use tracing::error;
|
||||
use tracing::{info, warn};
|
||||
use v_byte_helpers::ReadExtensions;
|
||||
use v_byte_helpers::little_endian::read_u16;
|
||||
use rnex_util::{PID, account::Account};
|
||||
use rnex_prudp::encryption::EncryptionPair;
|
||||
use rnex_prudp::types_flags::types::{SYN, CONNECT, PING, DISCONNECT, DATA};
|
||||
use rnex_prudp::types_flags::flags::{ACK, HAS_SIZE, NEED_ACK, MULTI_ACK, RELIABLE};
|
||||
use rnex_prudp::types_flags::TypesFlags;
|
||||
use rnex_prudp::socket_addr::PRUDPSockAddr;
|
||||
use rnex_prudp::virtual_port::VirtualPort;
|
||||
|
||||
use std::time::Duration;
|
||||
use tokio::net::UdpSocket;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use crate::prudp::packet::PRUDPV1Packet;
|
|||
use crate::prudp::socket::{CryptoHandler, CryptoHandlerConnectionInstance};
|
||||
use rc4::{KeyInit, Rc4, StreamCipher};
|
||||
use rnex_prudp::encryption::{DEFAULT_KEY, EncryptionPair};
|
||||
use typenum::U5;
|
||||
|
||||
pub struct Unsecure(pub &'static str);
|
||||
|
||||
|
|
@ -52,7 +51,7 @@ impl CryptoHandler for Unsecure {
|
|||
}
|
||||
|
||||
impl CryptoHandlerConnectionInstance for UnsecureInstance {
|
||||
type Encryption = Rc4<U5>;
|
||||
type Encryption = Rc4;
|
||||
|
||||
fn decrypt_incoming(&mut self, substream: u8, data: &mut [u8]) {
|
||||
if let Some(crypt_pair) = self.streams.get_mut(substream as usize) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ ctor = "1.0.8"
|
|||
rnex-rmc = { path = "../../rnex-rmc" }
|
||||
rnex-base-protos = { path = "../base-protos" }
|
||||
|
||||
[feature]
|
||||
[features]
|
||||
datastore = []
|
||||
|
||||
[lints]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ ctor = "1.0.8"
|
|||
rnex-rmc = { path = "../../rnex-rmc" }
|
||||
cfg-if = "1.0.4"
|
||||
rnex-base-protos = { path = "../base-protos" }
|
||||
rnex-util = {path = "../rnex-util"}
|
||||
rnex-util = {path = "../../rnex-util"}
|
||||
|
||||
[features]
|
||||
third-notif-param = []
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use proc_macro2::{Literal, Span, TokenStream};
|
||||
use quote::{quote, ToTokens};
|
||||
use quote::{ToTokens, quote};
|
||||
use syn::{
|
||||
bracketed, parse::Parse, punctuated::Punctuated, token::Bracket, DataEnum, DataStruct,
|
||||
DeriveInput, Field, Fields, Ident, LitStr, Meta, Token, Variant,
|
||||
DataEnum, DataStruct, DeriveInput, Field, Fields, Ident, LitStr, Meta, Token, Variant,
|
||||
bracketed, parse::Parse, punctuated::Punctuated, token::Bracket,
|
||||
};
|
||||
|
||||
use crate::util::fold_tokenable;
|
||||
|
|
@ -85,11 +85,11 @@ pub fn generate_write_size_struct(
|
|||
}));
|
||||
quote! {
|
||||
#attrs
|
||||
sum += ::rnex_rmc::serialization::RmcSerialize::serialize_write_size(&self.#ident)?;
|
||||
let sum = sum + ::rnex_rmc::serialization::RmcSerialize::serialize_write_size(&self.#ident)?;
|
||||
}
|
||||
}));
|
||||
let optional_struct_header_calc = if with_potential_header {
|
||||
quote! { sum += (if ::rnex_rmc::config::FEATURE_HAS_STRUCT_HEADER{ 5 } else { 0 }); }
|
||||
quote! { let sum = sum + (if ::rnex_rmc::config::FEATURE_HAS_STRUCT_HEADER{ 5 } else { 0 }); }
|
||||
} else {
|
||||
quote! {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use bytemuck::bytes_of;
|
|||
use rnex_util::SendingBufferConnection;
|
||||
use std::io;
|
||||
use std::io::{Read, Seek, Write};
|
||||
use std::mem::transmute;
|
||||
use tracing::{error, warn};
|
||||
use v_byte_helpers::EnumTryInto;
|
||||
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl RnexManager for BaseManager {
|
|||
) -> Self::User {
|
||||
BaseUser {
|
||||
cid: this.cid_counter.fetch_add(1, Relaxed),
|
||||
bm: this,
|
||||
//bm: this,
|
||||
addr: init_data.addr,
|
||||
pid: init_data.pid,
|
||||
station_url: Default::default(),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ pub async fn get_station_urls(
|
|||
#[rmc_struct(BaseProtocol)]
|
||||
#[derive(Debug)]
|
||||
pub struct BaseUser {
|
||||
pub(crate) bm: PassthroughInitModule<BaseManager>,
|
||||
// pub(crate) bm: PassthroughInitModule<BaseManager>,
|
||||
pub addr: SocketAddr,
|
||||
pub station_url: RwLock<Vec<StationUrl>>,
|
||||
pub pid: PID,
|
||||
|
|
|
|||
|
|
@ -21,5 +21,8 @@ nex-account = { version = "0.2.4", registry = "spbr" }
|
|||
hex = "0.4.3"
|
||||
thiserror = "2.0.18"
|
||||
|
||||
[features]
|
||||
friends = []
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(feature = "friends")]
|
||||
use crate::friends_handler::{FriendsGuest, FriendsUser};
|
||||
use nex_account::GUEST_PID;
|
||||
use rnex_fpd_protos::RemoteFriendRemote;
|
||||
|
|
|
|||
|
|
@ -210,11 +210,14 @@ impl ExtendedMatchmakeSession {
|
|||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "v3-5-0")]{
|
||||
use rnex_rmc::variant::Variant;
|
||||
use rnex_util::date_time::DateTime;
|
||||
use rnex_mm_protos::matchmake::MatchmakeParam;
|
||||
let mm_session = MatchmakeSession {
|
||||
gathering: Gathering {
|
||||
self_gid: gid,
|
||||
owner_pid: host.pid,
|
||||
host_pid: host.pid,
|
||||
owner_pid: host.base.pid,
|
||||
host_pid: host.base.pid,
|
||||
..session.gathering.clone()
|
||||
},
|
||||
datetime: DateTime::now(),
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ impl RnexManager for RankingManager {
|
|||
|
||||
async fn init_new_user(
|
||||
this: rnex_server::PassthroughInitModule<Self>,
|
||||
mod_holder: &rnex_server::ModuleHolder,
|
||||
remote: &rnex_rmc::RmcConnection,
|
||||
_: &rnex_server::ModuleHolder,
|
||||
_: &rnex_rmc::RmcConnection,
|
||||
init_data: &Self::InitData,
|
||||
weak_user: rnex_server::WeakPassthroughInitModule<Self::User>,
|
||||
_: rnex_server::WeakPassthroughInitModule<Self::User>,
|
||||
) -> Self::User {
|
||||
RankingUser {
|
||||
rm: this,
|
||||
|
|
|
|||
Loading…
Reference in a new issue