modules encapsulate from each other
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::net::connection::muxer::{MuxMessage, Muxer};
|
||||
use crate::net::network::NetworkConfig;
|
||||
use crate::nrxp::frame::FrameType;
|
||||
use crate::nrxp::FrameType;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use netrunner_logger::{debug, error};
|
||||
use tokio::net::UdpSocket;
|
||||
|
||||
@@ -6,13 +6,10 @@ use crate::{
|
||||
network::NetworkConfig,
|
||||
},
|
||||
nrxp::{
|
||||
codec::Codec,
|
||||
errors::ErrorAction,
|
||||
frame::FrameType,
|
||||
socks::{SocksReply, SocksRequest},
|
||||
Codec, ErrorAction, FrameType, {SocksReply, SocksRequest},
|
||||
},
|
||||
parser::Parser,
|
||||
tlseng::profile::BrowserProfile,
|
||||
tlseng::BrowserProfile,
|
||||
};
|
||||
use bytes::BytesMut;
|
||||
use netrunner_logger::{info, warn};
|
||||
@@ -93,8 +90,8 @@ impl Connection {
|
||||
}
|
||||
|
||||
pub struct ClientHandler {
|
||||
pub conn: Connection,
|
||||
pub muxer: Muxer,
|
||||
pub(crate) conn: Connection,
|
||||
pub(crate) muxer: Muxer,
|
||||
}
|
||||
|
||||
impl ClientHandler {
|
||||
@@ -249,8 +246,7 @@ impl TunnelHandler for ClientHandler {
|
||||
}
|
||||
|
||||
pub struct ServerHandler {
|
||||
pub conn: Connection,
|
||||
pub token: CancellationToken,
|
||||
pub(crate) conn: Connection,
|
||||
}
|
||||
impl ServerHandler {
|
||||
async fn handle_stealth_fallback(
|
||||
|
||||
@@ -11,7 +11,7 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::{
|
||||
net::connection::{handler::StreamHandler, muxer::MuxMessage},
|
||||
nrxp::{codec::Codec, errors::ErrorAction, frame::FrameType},
|
||||
nrxp::{Codec, ErrorAction, FrameType},
|
||||
};
|
||||
|
||||
pub(crate) struct TunnelEngine {
|
||||
|
||||
@@ -11,8 +11,7 @@ use crate::{
|
||||
network::NetworkConfig,
|
||||
},
|
||||
nrxp::{
|
||||
frame::{Frame, FrameType},
|
||||
socks::SocksReply,
|
||||
SocksReply, {Frame, FrameType},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc::{error::SendError, Sender};
|
||||
|
||||
use crate::nrxp::frame::FrameType;
|
||||
use crate::nrxp::FrameType;
|
||||
|
||||
struct IdGenerator {
|
||||
counter: AtomicU32,
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::sync::OnceLock;
|
||||
|
||||
use crate::{
|
||||
net::connection::{ClientHandler, Connection, ConnectionRole, ServerHandler, TunnelHandler},
|
||||
nrxp::frame::{FRAME_HEADER_SIZE, MAX_PADDING_SIZE},
|
||||
nrxp::{FRAME_HEADER_SIZE, MAX_PADDING_SIZE},
|
||||
};
|
||||
use netrunner_logger::{error, info};
|
||||
use tokio::net::TcpListener;
|
||||
@@ -75,7 +75,7 @@ impl Network {
|
||||
res = listener.accept() => {
|
||||
if let Ok((stream, client_addr)) = res {
|
||||
let conn = Connection::new(stream, true);
|
||||
let handler = ServerHandler { conn, token: token.clone() };
|
||||
let handler = ServerHandler { conn };
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = handler.run().await {
|
||||
error!(client = %client_addr, error = %e, "Server handler error");
|
||||
|
||||
Reference in New Issue
Block a user