restrict what gets checked and implement sending of fragmented packets
This commit is contained in:
parent
29a8b015bd
commit
9275f3b09f
6 changed files with 85 additions and 46 deletions
11
check-all.sh
11
check-all.sh
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
SETTINGS=$(yq ea "." editions.yaml | yq 'keys[]')
|
||||
EDITIONS=$(yq ea "." editions.yaml | yq 'keys[]')
|
||||
IFS=$'\n'
|
||||
while IFS=$'\n' read -r EDITION; do
|
||||
export EDITION
|
||||
./check-edition.sh $EDITION
|
||||
done <<< "$SETTINGS"
|
||||
if [[ $(yq ea ".$EDITION.include-in-checkall" editions.yaml) == "true" ]]
|
||||
then
|
||||
export EDITION
|
||||
./check-edition.sh $EDITION
|
||||
fi
|
||||
done <<< "$EDITIONS"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
wiiu-chat:
|
||||
include-in-checkall: true
|
||||
features:
|
||||
- prudpv1
|
||||
- v3-8-15
|
||||
|
|
@ -9,6 +10,7 @@ wiiu-chat:
|
|||
RNEX_DEFAULT_PORT: 10000
|
||||
RNEX_ACCESS_KEY: "e7a47214"
|
||||
splatoon:
|
||||
include-in-checkall: true
|
||||
features:
|
||||
- prudpv1
|
||||
- v3-8-15
|
||||
|
|
@ -19,6 +21,7 @@ splatoon:
|
|||
RNEX_DEFAULT_PORT: 6000
|
||||
RNEX_ACCESS_KEY: "6f599f81"
|
||||
friends:
|
||||
include-in-checkall: false
|
||||
features:
|
||||
- friends
|
||||
settings:
|
||||
|
|
@ -28,6 +31,7 @@ friends:
|
|||
RNEX_DEFAULT_PORT: 6000
|
||||
RNEX_ACCESS_KEY: "ridfebb9"
|
||||
super-mario-maker:
|
||||
include-in-checkall: false
|
||||
features:
|
||||
- prudpv1
|
||||
- v3-8-15
|
||||
|
|
|
|||
|
|
@ -177,31 +177,40 @@ pub(super) trait AnyInternalConnection:
|
|||
#[async_trait]
|
||||
impl<T: CryptoHandlerConnectionInstance> AnyInternalConnection for InternalConnection<T> {
|
||||
async fn send_data_packet(&mut self, data: Vec<u8>) {
|
||||
let mut packet = PRUDPV1Packet {
|
||||
header: PRUDPV1Header {
|
||||
sequence_id: self.next_server_count(),
|
||||
substream_id: 0,
|
||||
session_id: self.session_id,
|
||||
types_and_flags: TypesFlags::default().types(DATA).flags(RELIABLE | NEED_ACK),
|
||||
destination_port: self.common.socket_addr.virtual_port,
|
||||
source_port: self.server_port,
|
||||
let pieces = data.chunks(600);
|
||||
let max_piece = pieces.len() - 1;
|
||||
let mut piece_num = 1;
|
||||
for (i, piece) in pieces.enumerate() {
|
||||
let mut packet = PRUDPV1Packet {
|
||||
header: PRUDPV1Header {
|
||||
sequence_id: self.next_server_count(),
|
||||
substream_id: 0,
|
||||
session_id: self.session_id,
|
||||
types_and_flags: TypesFlags::default().types(DATA).flags(RELIABLE | NEED_ACK),
|
||||
destination_port: self.common.socket_addr.virtual_port,
|
||||
source_port: self.server_port,
|
||||
..Default::default()
|
||||
},
|
||||
payload: piece.to_owned(),
|
||||
options: vec![FragmentId(if i == max_piece { 0 } else { piece_num })],
|
||||
..Default::default()
|
||||
},
|
||||
payload: data,
|
||||
options: vec![FragmentId(0)],
|
||||
..Default::default()
|
||||
};
|
||||
};
|
||||
|
||||
self.crypto_handler_instance
|
||||
.encrypt_outgoing(0, &mut packet.payload[..]);
|
||||
self.crypto_handler_instance
|
||||
.encrypt_outgoing(0, &mut packet.payload[..]);
|
||||
|
||||
packet.set_sizes();
|
||||
packet.set_sizes();
|
||||
|
||||
self.crypto_handler_instance.sign_packet(&mut packet);
|
||||
self.crypto_handler_instance.sign_packet(&mut packet);
|
||||
|
||||
self.send_raw_packet(&packet).await;
|
||||
self.send_raw_packet(&packet).await;
|
||||
|
||||
self.unacknowleged_packets.push((Instant::now(), packet));
|
||||
self.unacknowleged_packets.push((Instant::now(), packet));
|
||||
|
||||
sleep(Duration::from_secs(16)).await;
|
||||
|
||||
piece_num += 1;
|
||||
}
|
||||
}
|
||||
|
||||
async fn close_connection(&mut self) {
|
||||
|
|
|
|||
|
|
@ -8,18 +8,15 @@ use std::io::Cursor;
|
|||
use std::net::{Ipv4Addr, SocketAddrV4};
|
||||
use std::sync::Arc;
|
||||
use tokio::net::TcpListener;
|
||||
use std::sync::LazyLock;
|
||||
use std::sync::OnceLock;
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "datastore")] {
|
||||
use sqlx::postgres::PgPool;
|
||||
}
|
||||
}
|
||||
use crate::reggie::UnitPacketRead;
|
||||
use cfg_if::cfg_if;
|
||||
use log::error;
|
||||
use std::error::Error;
|
||||
use std::string::ToString;
|
||||
use cfg_if::cfg_if;
|
||||
use crate::reggie::UnitPacketRead;
|
||||
|
||||
const IP_REQ_SERVICE_URL: &str = "https://ipinfo.io/ip";
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ use rnex_core::rmc::protocols::matchmake_extension::{
|
|||
};
|
||||
use rnex_core::rmc::protocols::ranking::{Ranking, RawRanking, RawRankingInfo, RemoteRanking};
|
||||
use rnex_core::rmc::protocols::secure::{RawSecure, RawSecureInfo, RemoteSecure, Secure};
|
||||
use rnex_core::rmc::protocols::datastore::{DataStore, RawDataStore, RawDataStoreInfo, RemoteDataStore};
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::rmc::structures::any::Any;
|
||||
use rnex_core::rmc::structures::matchmake::{
|
||||
|
|
@ -34,6 +33,7 @@ use std::env;
|
|||
use std::str::FromStr;
|
||||
|
||||
use crate::rmc::protocols::notifications::{NotificationEvent, RemoteNotification};
|
||||
use cfg_if::cfg_if;
|
||||
use log::{error, info};
|
||||
use macros::rmc_struct;
|
||||
use rnex_core::prudp::socket_addr::PRUDPSockAddr;
|
||||
|
|
@ -45,11 +45,11 @@ use rnex_core::rmc::structures::qbuffer::QBuffer;
|
|||
use rnex_core::rmc::structures::qresult::QResult;
|
||||
use rnex_core::rmc::structures::ranking::UploadCompetitionData;
|
||||
use std::sync::{Arc, Weak};
|
||||
use cfg_if::cfg_if;
|
||||
use tokio::sync::{Mutex, RwLock};
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "datastore")] {
|
||||
use rnex_core::rmc::protocols::datastore::{DataStore, RawDataStore, RawDataStoreInfo, RemoteDataStore};
|
||||
define_rmc_proto!(
|
||||
proto UserProtocol{
|
||||
Secure,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use macros::{method_id, rmc_proto, RmcSerialize, rmc_struct};
|
||||
use rnex_core::rmc::structures::qbuffer::QBuffer;
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::rmc::structures::qresult::QResult;
|
||||
use rnex_core::kerberos::KerberosDateTime;
|
||||
use macros::{RmcSerialize, method_id, rmc_proto};
|
||||
use rnex_core::PID;
|
||||
use rnex_core::kerberos::KerberosDateTime;
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::rmc::structures::qbuffer::QBuffer;
|
||||
use rnex_core::rmc::structures::qresult::QResult;
|
||||
use rnex_core::rmc::structures::resultsrange::ResultsRange;
|
||||
|
||||
#[derive(RmcSerialize, Clone, Debug, Default)]
|
||||
|
|
@ -78,7 +78,7 @@ pub struct RatingInitParam {
|
|||
pub range_min: i32,
|
||||
pub range_max: i32,
|
||||
pub period_hour: i8,
|
||||
pub period_duration: i16
|
||||
pub period_duration: i16,
|
||||
}
|
||||
|
||||
#[derive(RmcSerialize, Clone)]
|
||||
|
|
@ -214,27 +214,53 @@ pub struct DataStoreSearchParam {
|
|||
}
|
||||
|
||||
#[rmc_proto(115)]
|
||||
pub trait DataStore{
|
||||
pub trait DataStore {
|
||||
#[method_id(8)]
|
||||
async fn get_meta(&self, metaparam: GetMetaParam) -> Result<GetMetaInfo, ErrorCode>;
|
||||
#[method_id(36)]
|
||||
async fn get_metas_multiple_param(&self, params: Vec<GetMetaParam>) -> Result<(Vec<GetMetaInfo>, Vec<QResult>), ErrorCode>;
|
||||
async fn get_metas_multiple_param(
|
||||
&self,
|
||||
params: Vec<GetMetaParam>,
|
||||
) -> Result<(Vec<GetMetaInfo>, Vec<QResult>), ErrorCode>;
|
||||
#[method_id(24)]
|
||||
async fn prepare_post_object(&self, postparam: PreparePostParam) -> Result<ReqPostInfo, ErrorCode>;
|
||||
async fn prepare_post_object(
|
||||
&self,
|
||||
postparam: PreparePostParam,
|
||||
) -> Result<ReqPostInfo, ErrorCode>;
|
||||
#[method_id(26)]
|
||||
async fn complete_post_object(&self, completeparam: CompletePostParam) -> Result<(), ErrorCode>;
|
||||
async fn complete_post_object(&self, completeparam: CompletePostParam)
|
||||
-> Result<(), ErrorCode>;
|
||||
#[method_id(48)]
|
||||
async fn rate_custom_ranking(&self, rankingparam: Vec<RateCustomRankingParam>) -> Result<(), ErrorCode>;
|
||||
async fn rate_custom_ranking(
|
||||
&self,
|
||||
rankingparam: Vec<RateCustomRankingParam>,
|
||||
) -> Result<(), ErrorCode>;
|
||||
#[method_id(61)]
|
||||
async fn get_application_config(&self, appid: u32) -> Result<Vec<i32>, ErrorCode>;
|
||||
#[method_id(50)]
|
||||
async fn get_custom_ranking_by_data_id(&self, custom_ranking_param: DataStoreGetCustomRankingByDataIDParam) -> Result<(Vec<DataStoreCustomRankingResult>, Vec<QResult>), ErrorCode>;
|
||||
async fn get_custom_ranking_by_data_id(
|
||||
&self,
|
||||
custom_ranking_param: DataStoreGetCustomRankingByDataIDParam,
|
||||
) -> Result<(Vec<DataStoreCustomRankingResult>, Vec<QResult>), ErrorCode>;
|
||||
#[method_id(54)]
|
||||
async fn get_buffer_queue(&self, bufferparam: BufferQueueParam) -> Result<Vec<QBuffer>, ErrorCode>;
|
||||
async fn get_buffer_queue(
|
||||
&self,
|
||||
bufferparam: BufferQueueParam,
|
||||
) -> Result<Vec<QBuffer>, ErrorCode>;
|
||||
#[method_id(25)]
|
||||
async fn prepare_get_object(&self, prepare_get_param: DataStorePrepareGetParam) -> Result<DataStoreReqGetInfo, ErrorCode>;
|
||||
async fn prepare_get_object(
|
||||
&self,
|
||||
prepare_get_param: DataStorePrepareGetParam,
|
||||
) -> Result<DataStoreReqGetInfo, ErrorCode>;
|
||||
#[method_id(65)]
|
||||
async fn followings_latest_course_search_object(&self, course_search_param: DataStoreSearchParam, extra_data: Vec<String>) -> Result<Vec<DataStoreCustomRankingResult>, ErrorCode>;
|
||||
async fn followings_latest_course_search_object(
|
||||
&self,
|
||||
course_search_param: DataStoreSearchParam,
|
||||
extra_data: Vec<String>,
|
||||
) -> Result<Vec<DataStoreCustomRankingResult>, ErrorCode>;
|
||||
#[method_id(74)]
|
||||
async fn get_application_config_string(&self, application_id: u32) -> Result<Vec<String>, ErrorCode>;
|
||||
async fn get_application_config_string(
|
||||
&self,
|
||||
application_id: u32,
|
||||
) -> Result<Vec<String>, ErrorCode>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue