Skip to content

Commit

Permalink
Refactor tunnel connection to use GEPH5_CONFIG_TEMPLATE and streamlin…
Browse files Browse the repository at this point in the history
…e config setup
  • Loading branch information
nullchinchilla committed Aug 13, 2024
1 parent e4f7b26 commit e0f1b1a
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions src/connect/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Arc;

use std::net::Ipv4Addr;

use crate::config::ConnectOpt;
use crate::config::{ConnectOpt, GEPH5_CONFIG_TEMPLATE};

use super::stats::{gatherer::StatItem, STATS_GATHERER};

Expand Down Expand Up @@ -74,28 +74,15 @@ impl ClientTunnel {
}
_ => todo!(),
};
let client = geph5_client::Client::start(Config {
socks5_listen: None,
http_proxy_listen: None,

control_listen: None,
exit_constraint: geph5_client::ExitConstraint::Auto,
bridge_mode: if opt.use_bridges {
BridgeMode::ForceBridges
} else {
BridgeMode::Auto
},
cache: None,
broker: Some(BrokerSource::Fronted {
front: "https://vuejs.org".into(),
host: "svitania-naidallszei-2.netlify.app".into(),
}),
vpn: false,
spoof_dns: true,
passthrough_china: false,
dry_run: false,
credentials: Credential::LegacyUsernamePassword { username, password },
});
let mut config = GEPH5_CONFIG_TEMPLATE.clone();
config.credentials = Credential::LegacyUsernamePassword { username, password };
config.bridge_mode = if opt.use_bridges {
BridgeMode::ForceBridges
} else {
BridgeMode::Auto
};
config.cache = Some(opt.auth.credential_cache.clone());
let client = geph5_client::Client::start(config);
let handle = client.control_client();
let stat_reporter = smolscale::spawn(async move {
loop {
Expand Down

0 comments on commit e0f1b1a

Please sign in to comment.