Loading crates/arti-client/src/client.rs +1 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ use futures::stream::StreamExt; use futures::task::SpawnExt; use std::convert::TryInto; use std::net::IpAddr; use std::str::FromStr; use std::sync::{Arc, Weak}; use std::time::Duration; Loading Loading @@ -272,12 +271,11 @@ impl<R: Runtime> TorClient<R> { /// On success, return a list of hostnames. pub async fn resolve_ptr( &self, addr: &str, addr: IpAddr, flags: Option<ConnectPrefs>, ) -> Result<Vec<String>> { let flags = flags.unwrap_or_default(); let circ = self.get_or_launch_exit_circ(&[], &flags).await?; let addr = IpAddr::from_str(addr)?; // TODO: make this configurable. let resolve_ptr_timeout = Duration::new(10, 0); Loading crates/arti-client/src/err.rs +0 −6 Original line number Diff line number Diff line Loading @@ -63,9 +63,3 @@ impl From<futures::task::SpawnError> for Error { Error::Internal("Couldn't spawn channel reactor") } } impl From<std::net::AddrParseError> for Error { fn from(_: std::net::AddrParseError) -> Error { Error::Internal("Couldn't parse IP address") } } crates/arti/src/proxy.rs +13 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,19 @@ where SocksCmd::RESOLVE_PTR => { // We've been asked to perform a reverse hostname lookup. // (This is a tor-specific SOCKS extension.) let hosts = tor_client.resolve_ptr(&addr, Some(prefs)).await?; let addr: IpAddr = match addr.parse() { Ok(ip) => ip, Err(e) => { let reply = request.reply(tor_socksproto::SocksStatus::ADDRTYPE_NOT_SUPPORTED, None); socks_w .write(&reply[..]) .await .context("Couldn't write SOCKS reply")?; return Err(anyhow!(e)); } }; let hosts = tor_client.resolve_ptr(addr, Some(prefs)).await?; if let Some(host) = hosts.into_iter().next() { let reply = request.reply( tor_socksproto::SocksStatus::SUCCEEDED, Loading Loading
crates/arti-client/src/client.rs +1 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ use futures::stream::StreamExt; use futures::task::SpawnExt; use std::convert::TryInto; use std::net::IpAddr; use std::str::FromStr; use std::sync::{Arc, Weak}; use std::time::Duration; Loading Loading @@ -272,12 +271,11 @@ impl<R: Runtime> TorClient<R> { /// On success, return a list of hostnames. pub async fn resolve_ptr( &self, addr: &str, addr: IpAddr, flags: Option<ConnectPrefs>, ) -> Result<Vec<String>> { let flags = flags.unwrap_or_default(); let circ = self.get_or_launch_exit_circ(&[], &flags).await?; let addr = IpAddr::from_str(addr)?; // TODO: make this configurable. let resolve_ptr_timeout = Duration::new(10, 0); Loading
crates/arti-client/src/err.rs +0 −6 Original line number Diff line number Diff line Loading @@ -63,9 +63,3 @@ impl From<futures::task::SpawnError> for Error { Error::Internal("Couldn't spawn channel reactor") } } impl From<std::net::AddrParseError> for Error { fn from(_: std::net::AddrParseError) -> Error { Error::Internal("Couldn't parse IP address") } }
crates/arti/src/proxy.rs +13 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,19 @@ where SocksCmd::RESOLVE_PTR => { // We've been asked to perform a reverse hostname lookup. // (This is a tor-specific SOCKS extension.) let hosts = tor_client.resolve_ptr(&addr, Some(prefs)).await?; let addr: IpAddr = match addr.parse() { Ok(ip) => ip, Err(e) => { let reply = request.reply(tor_socksproto::SocksStatus::ADDRTYPE_NOT_SUPPORTED, None); socks_w .write(&reply[..]) .await .context("Couldn't write SOCKS reply")?; return Err(anyhow!(e)); } }; let hosts = tor_client.resolve_ptr(addr, Some(prefs)).await?; if let Some(host) = hosts.into_iter().next() { let reply = request.reply( tor_socksproto::SocksStatus::SUCCEEDED, Loading