fix more warnings and add script to check all editions
This commit is contained in:
parent
a88f1898a5
commit
7f27ad0a3c
14 changed files with 38 additions and 91 deletions
|
|
@ -1,17 +0,0 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use std::env;
|
||||
use std::net::SocketAddrV4;
|
||||
|
||||
pub static EDGE_NODE_HOLDER: Lazy<SocketAddrV4> = Lazy::new(|| {
|
||||
env::var("EDGE_NODE_HOLDER")
|
||||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.expect("EDGE_NODE_HOLDER not set")
|
||||
});
|
||||
|
||||
pub static FORWARD_DESTINATION: Lazy<SocketAddrV4> = Lazy::new(|| {
|
||||
env::var("FORWARD_DESTINATION")
|
||||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.expect("FORWARD_DESTINATION not set")
|
||||
});
|
||||
|
|
@ -1,3 +1,2 @@
|
|||
pub mod common;
|
||||
pub mod proxy_insecure;
|
||||
pub mod proxy_secure;
|
||||
|
|
|
|||
|
|
@ -1,45 +1,19 @@
|
|||
use crate::executables::common::{EDGE_NODE_HOLDER, FORWARD_DESTINATION};
|
||||
use crate::prudp::router::Router;
|
||||
use crate::prudp::unsecure::Unsecure;
|
||||
use log::error;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::executables::common::{OWN_IP_PRIVATE, OWN_IP_PUBLIC, SERVER_PORT};
|
||||
use proxy_common::{ProxyStartupParam, RNEX_ACCESS_KEY};
|
||||
use rnex_core::prudp::virtual_port::VirtualPort;
|
||||
use rnex_core::reggie::EdgeNodeHolderConnectOption::Register;
|
||||
use rnex_core::reggie::RemoteEdgeNodeHolder;
|
||||
use rnex_core::reggie::UnitPacketRead;
|
||||
use rnex_core::reggie::UnitPacketWrite;
|
||||
use rnex_core::rmc::protocols::{OnlyRemote, new_rmc_gateway_connection};
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::task;
|
||||
use tokio::time::sleep;
|
||||
use proxy_common::RNEX_ACCESS_KEY;
|
||||
|
||||
pub async fn start() {
|
||||
/*let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let conn: SplittableBufferConnection = conn.into();
|
||||
|
||||
conn.send(
|
||||
Register(SocketAddrV4::new(*OWN_IP_PUBLIC, *SERVER_PORT))
|
||||
.to_data()
|
||||
.unwrap(),
|
||||
)
|
||||
.await;
|
||||
|
||||
let conn = new_rmc_gateway_connection(conn, |r| {
|
||||
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
||||
});*/
|
||||
|
||||
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
||||
pub async fn start(param: ProxyStartupParam) {
|
||||
let (router_secure, _) = Router::new(param.self_private)
|
||||
.await
|
||||
.expect("unable to start router");
|
||||
|
||||
|
|
@ -48,8 +22,6 @@ pub async fn start() {
|
|||
.await
|
||||
.expect("unable to add socket");
|
||||
|
||||
// let conn = socket_secure.connect(auth_sockaddr).await.unwrap();
|
||||
|
||||
loop {
|
||||
let Some(mut conn) = socket_secure.accept().await else {
|
||||
error!("server crashed");
|
||||
|
|
@ -57,7 +29,7 @@ pub async fn start() {
|
|||
};
|
||||
|
||||
task::spawn(async move {
|
||||
let mut stream = match TcpStream::connect(*FORWARD_DESTINATION).await {
|
||||
let mut stream = match TcpStream::connect(param.forward_destination).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("unable to connect: {}", e);
|
||||
|
|
|
|||
|
|
@ -1,30 +1,20 @@
|
|||
use crate::executables::common::{EDGE_NODE_HOLDER, FORWARD_DESTINATION};
|
||||
use crate::prudp::router::Router;
|
||||
use crate::prudp::secure::Secure;
|
||||
use log::error;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::executables::common::{
|
||||
OWN_IP_PRIVATE, OWN_IP_PUBLIC, SECURE_SERVER_ACCOUNT, SERVER_PORT,
|
||||
};
|
||||
use proxy_common::{ProxyStartupParam, RNEX_ACCESS_KEY};
|
||||
use rnex_core::executables::common::SECURE_SERVER_ACCOUNT;
|
||||
use rnex_core::prudp::virtual_port::VirtualPort;
|
||||
use rnex_core::reggie::EdgeNodeHolderConnectOption::Register;
|
||||
use rnex_core::reggie::RemoteEdgeNodeHolder;
|
||||
use rnex_core::reggie::UnitPacketRead;
|
||||
use rnex_core::reggie::UnitPacketWrite;
|
||||
use rnex_core::rmc::protocols::{OnlyRemote, new_rmc_gateway_connection};
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use rnex_core::rnex_proxy_common::ConnectionInitData;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::task;
|
||||
use tokio::time::sleep;
|
||||
use proxy_common::RNEX_ACCESS_KEY;
|
||||
|
||||
pub async fn start() {
|
||||
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
||||
pub async fn start(param: ProxyStartupParam) {
|
||||
let (router_secure, _) = Router::new(param.self_private)
|
||||
.await
|
||||
.expect("unable to start router");
|
||||
|
||||
|
|
@ -36,8 +26,6 @@ pub async fn start() {
|
|||
.await
|
||||
.expect("unable to add socket");
|
||||
|
||||
// let conn = socket_secure.connect(auth_sockaddr).await.unwrap();
|
||||
|
||||
loop {
|
||||
let Some(mut conn) = socket_secure.accept().await else {
|
||||
error!("server crashed");
|
||||
|
|
@ -45,7 +33,7 @@ pub async fn start() {
|
|||
};
|
||||
|
||||
task::spawn(async move {
|
||||
let mut stream = match TcpStream::connect(*FORWARD_DESTINATION).await {
|
||||
let mut stream = match TcpStream::connect(param.forward_destination).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("unable to connect: {}", e);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "prudpv1")]{
|
||||
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
|
||||
use proxy_common::ProxyStartupParam;
|
||||
pub mod executables;
|
||||
pub mod prudp;
|
||||
pub async fn start_secure(param: ProxyStartupParam) {
|
||||
executables::proxy_secure::start().await;
|
||||
executables::proxy_secure::start(param).await;
|
||||
}
|
||||
|
||||
pub async fn start_insecure(param: ProxyStartupParam) {
|
||||
executables::proxy_insecure::start().await;
|
||||
executables::proxy_insecure::start(param).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use rnex_core::prudp::socket_addr::PRUDPSockAddr;
|
|||
use rnex_core::prudp::types_flags::TypesFlags;
|
||||
use rnex_core::prudp::types_flags::flags::ACK;
|
||||
use rnex_core::prudp::virtual_port::VirtualPort;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::fmt::Debug;
|
||||
use std::io;
|
||||
use std::io::{Cursor, Read, Seek, Write};
|
||||
use std::net::SocketAddr;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
use crate::prudp::packet::PRUDPV1Packet;
|
||||
use crate::prudp::socket::{CryptoHandler, CryptoHandlerConnectionInstance};
|
||||
use hmac::digest::consts::U32;
|
||||
use log::error;
|
||||
use rc4::cipher::StreamCipherCoreWrapper;
|
||||
use rc4::consts::U16;
|
||||
use rc4::{KeyInit, Rc4, Rc4Core, StreamCipher};
|
||||
use rnex_core::kerberos::{TicketInternalData, derive_key};
|
||||
use rnex_core::nex::account::Account;
|
||||
use rnex_core::prudp::encryption::EncryptionPair;
|
||||
use rnex_core::prudp::ticket::read_secure_connection_data;
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use std::io::Cursor;
|
||||
use typenum::U5;
|
||||
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
|
||||
|
||||
type Rc4U32 = StreamCipherCoreWrapper<Rc4Core<U32>>;
|
||||
|
||||
|
|
@ -52,6 +47,7 @@ pub struct SecureInstance {
|
|||
session_key: [u8; 32],
|
||||
streams: Vec<EncryptionPair<Rc4<U32>>>,
|
||||
self_signature: [u8; 16],
|
||||
#[allow(dead_code)]
|
||||
remote_signature: [u8; 16],
|
||||
pid: u32,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::prudp::packet::PRUDPV1Packet;
|
||||
use crate::prudp::socket::{CryptoHandler, CryptoHandlerConnectionInstance};
|
||||
use once_cell::sync::Lazy;
|
||||
use rc4::{Key, KeyInit, Rc4, StreamCipher};
|
||||
use rc4::{KeyInit, Rc4, StreamCipher};
|
||||
use rnex_core::prudp::encryption::{DEFAULT_KEY, EncryptionPair};
|
||||
use typenum::U5;
|
||||
|
||||
|
|
@ -11,6 +10,7 @@ pub struct UnsecureInstance {
|
|||
key: &'static str,
|
||||
streams: Vec<EncryptionPair<Rc4<U5>>>,
|
||||
self_signature: [u8; 16],
|
||||
#[allow(dead_code)]
|
||||
remote_signature: [u8; 16],
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue