mirror of
https://github.com/cfal/shoes.git
synced 2026-11-06 08:14:11 +00:00
Keep REALITY client and server handlers in the same module
This commit is contained in:
@@ -67,7 +67,6 @@ mod quic_endpoint;
|
||||
mod quic_server;
|
||||
mod quic_stream;
|
||||
mod reality;
|
||||
mod reality_client_handler;
|
||||
pub mod resolver;
|
||||
pub mod resources;
|
||||
mod routing;
|
||||
|
||||
@@ -25,7 +25,6 @@ mod quic_endpoint;
|
||||
mod quic_server;
|
||||
mod quic_stream;
|
||||
mod reality;
|
||||
mod reality_client_handler;
|
||||
mod resolver;
|
||||
mod resources;
|
||||
mod routing;
|
||||
|
||||
@@ -5,6 +5,7 @@ mod reality_certificate;
|
||||
mod reality_certificate_verify;
|
||||
mod reality_cipher_suite;
|
||||
mod reality_client;
|
||||
mod reality_client_handler;
|
||||
mod reality_config;
|
||||
mod reality_hello;
|
||||
mod reality_mldsa;
|
||||
@@ -36,5 +37,6 @@ pub use reality_config::{
|
||||
};
|
||||
|
||||
pub use reality_client::RealityClientConfig;
|
||||
pub use reality_client_handler::RealityClientHandler;
|
||||
pub use reality_server::RealityServerConfig;
|
||||
pub use reality_server_handler::{RealityServerTarget, setup_reality_server_stream};
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use super::{CipherSuite, Mldsa65VerifyKey, RealityClientConfig};
|
||||
use crate::address::ResolvedLocation;
|
||||
use crate::async_stream::AsyncStream;
|
||||
use crate::crypto::{CryptoTlsStream, TlsReadMode};
|
||||
use crate::reality::{CipherSuite, RealityClientConfig};
|
||||
use crate::tcp::tcp_handler::{TcpClientHandler, TcpClientSetupResult};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RealityClientHandler {
|
||||
mldsa65_verify: Option<crate::reality::Mldsa65VerifyKey>,
|
||||
mldsa65_verify: Option<Mldsa65VerifyKey>,
|
||||
public_key: [u8; 32],
|
||||
short_id: [u8; 8],
|
||||
server_name: rustls::pki_types::ServerName<'static>,
|
||||
@@ -62,7 +62,7 @@ impl RealityClientHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_mldsa65_verify(mut self, key: Option<crate::reality::Mldsa65VerifyKey>) -> Self {
|
||||
pub fn with_mldsa65_verify(mut self, key: Option<Mldsa65VerifyKey>) -> Self {
|
||||
self.mldsa65_verify = key;
|
||||
self
|
||||
}
|
||||
@@ -285,7 +285,7 @@ pub fn create_tcp_client_handler(
|
||||
.expect("Invalid user_id UUID")
|
||||
.into_boxed_slice();
|
||||
Box::new(
|
||||
crate::reality_client_handler::RealityClientHandler::new_vision_vless(
|
||||
crate::reality::RealityClientHandler::new_vision_vless(
|
||||
public_key_bytes,
|
||||
short_id_bytes,
|
||||
server_name,
|
||||
@@ -298,7 +298,7 @@ pub fn create_tcp_client_handler(
|
||||
} else {
|
||||
let inner_handler = create_tcp_client_handler(*protocol, None, resolver.clone())?;
|
||||
Box::new(
|
||||
crate::reality_client_handler::RealityClientHandler::new(
|
||||
crate::reality::RealityClientHandler::new(
|
||||
public_key_bytes,
|
||||
short_id_bytes,
|
||||
server_name,
|
||||
|
||||
@@ -181,7 +181,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn only_default_tls_and_reality_handlers_forward_reuse() {
|
||||
use crate::reality_client_handler::RealityClientHandler;
|
||||
use crate::reality::RealityClientHandler;
|
||||
let config = Arc::new(
|
||||
rustls::ClientConfig::builder()
|
||||
.with_root_certificates(rustls::RootCertStore::empty())
|
||||
|
||||
Reference in New Issue
Block a user