Skip to content

Commit

Permalink
Add StdcodeSerializeExt & Hashable imports, fix auth tuple cloning, e…
Browse files Browse the repository at this point in the history
…nhance credential cache path with stdcode hash in ClientTunnel creation
  • Loading branch information
nullchinchilla committed Aug 13, 2024
1 parent e0f1b1a commit bddcfdb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/connect/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use std::{
net::SocketAddr,
time::{Duration, SystemTime},
};
use stdcode::StdcodeSerializeExt;
use tmelcrypt::Hashable;

use sosistab2::Stream;
use std::sync::Arc;
Expand Down Expand Up @@ -68,9 +70,9 @@ pub struct ClientTunnel {
impl ClientTunnel {
/// Creates a new ClientTunnel.
pub fn new(opt: ConnectOpt) -> Self {
let (username, password) = match opt.auth.auth_kind {
let (username, password) = match &opt.auth.auth_kind {
Some(crate::config::AuthKind::AuthPassword { username, password }) => {
(username, password)
(username.clone(), password.clone())
}
_ => todo!(),
};
Expand All @@ -81,7 +83,12 @@ impl ClientTunnel {
} else {
BridgeMode::Auto
};
config.cache = Some(opt.auth.credential_cache.clone());
config.cache = Some(
opt.auth
.credential_cache
.clone()
.join(format!("cache-{}.db", opt.auth.stdcode().hash())),
);
let client = geph5_client::Client::start(config);
let handle = client.control_client();
let stat_reporter = smolscale::spawn(async move {
Expand Down

0 comments on commit bddcfdb

Please sign in to comment.