Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabrozzoni committed Oct 4, 2021
1 parent 4a6139f commit ebb766b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/tor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ compile_error!("Tor feature can't be used with msvc. Use mingw instead.");
pub struct TorProxy {
/// JoinHandle of the Tor daemon
pub tor_handle: Option<JoinHandle<Result<u8, libtor::Error>>>,
/// Host and port of the SOCKS5 proxy
pub address: String,
/// Host of the SOCKS5 proxy
pub host: String,
/// Socks port used by the Tor daemon
pub socks_port: u16,
/// Data directory used by the Tor daemon
Expand Down Expand Up @@ -70,10 +70,9 @@ impl TorProxy {
panic!("Can't find socks_port in logfile");
});

let address = format!("127.0.0.1:{}", socks_port);
TorProxy {
tor_handle,
address,
host: "127.0.0.1".into(),
socks_port,
data_directory,
}
Expand Down
4 changes: 3 additions & 1 deletion src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ impl KKTransport {
my_noise_privkey: &SecretKey,
their_noise_pubkey: &PublicKey,
) -> Result<KKTransport, Error> {
let mut stream = socks::Socks5Stream::connect(&proxy.address, addr)?.into_inner();
let mut stream =
socks::Socks5Stream::connect(&format!("{}:{}", proxy.host, proxy.socks_port), addr)?
.into_inner();
let timeout = Duration::from_secs(20);
stream.set_read_timeout(Some(timeout))?;
let channel = KKTransport::perform_client_handshake(
Expand Down

0 comments on commit ebb766b

Please sign in to comment.