Skip to content

Commit

Permalink
export stuff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Mar 26, 2024
1 parent 94e02e2 commit b227e63
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/bin/overtls.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -69,22 +69,22 @@ 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"));
}
} else if config.exist_client() {
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());
}
Expand Down
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit b227e63

Please sign in to comment.