diff --git a/src/bin/overtls.rs b/src/bin/overtls.rs index 571ec75..6a733e3 100644 --- a/src/bin/overtls.rs +++ b/src/bin/overtls.rs @@ -1,4 +1,4 @@ -use overtls::{client, config, server, CmdOpt, Error, Result}; +use overtls::{run_client, run_server, CmdOpt, Config, Error, Result}; fn main() -> Result<()> { let opt = CmdOpt::parse_cmd(); @@ -41,7 +41,7 @@ fn main() -> Result<()> { let is_server = opt.is_server(); - let mut config = config::Config::from_config_file(&opt.config)?; + let mut config = Config::from_config_file(&opt.config)?; config.set_cache_dns(opt.cache_dns); if opt.qrcode { @@ -69,14 +69,14 @@ fn main() -> Result<()> { rt.block_on(async_main(config)) } -async fn async_main(config: config::Config) -> Result<()> { +async fn async_main(config: Config) -> Result<()> { let shutdown_token = overtls::CancellationToken::new(); let shutdown_token_clone = shutdown_token.clone(); let main_body = async { if config.is_server { if config.exist_server() { - server::run_server(&config, shutdown_token_clone).await?; + run_server(&config, shutdown_token_clone).await?; } else { return Err(Error::from("Config is not a server config")); } @@ -84,7 +84,7 @@ async fn async_main(config: config::Config) -> Result<()> { let callback = |addr| { log::trace!("Listening on {}", addr); }; - client::run_client(&config, shutdown_token_clone, Some(callback)).await?; + run_client(&config, shutdown_token_clone, Some(callback)).await?; } else { return Err("Config is not a client config".into()); } diff --git a/src/lib.rs b/src/lib.rs index 4556052..4eb9b33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,13 @@ pub(crate) mod android; pub(crate) mod api; pub(crate) mod base64_wrapper; -pub mod client; +pub(crate) mod client; pub(crate) mod cmdopt; -pub mod config; +pub(crate) mod config; pub(crate) mod dns; -pub mod dump_logger; -pub mod error; -pub mod server; +pub(crate) mod dump_logger; +pub(crate) mod error; +pub(crate) mod server; pub(crate) mod tcp_stream; pub(crate) mod tls; pub(crate) mod traffic_audit; @@ -18,9 +18,12 @@ pub(crate) mod weirduri; pub use api::{over_tls_client_run, over_tls_client_run_with_ssr_url, over_tls_client_stop}; use base64_wrapper::{base64_decode, base64_encode, Base64Engine}; use bytes::BytesMut; +pub use client::run_client; pub use cmdopt::{ArgVerbosity, CmdOpt, Role}; +pub use config::Config; pub use dump_logger::overtls_set_log_callback; pub use error::{BoxError, Error, Result}; +pub use server::run_server; use socks5_impl::protocol::{Address, StreamOperation}; pub use tokio_util::sync::CancellationToken;