Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwample committed Mar 18, 2024
1 parent ce294fb commit a37deec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions crates/obfs4/src/bin/fwd_proxy/socks5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use safelog::sensitive;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tracing::{debug, warn};

use tor_socksproto::{SocksAuth, SocksCmd};
use tor_socksproto::SocksCmd; //SocksAuth

use std::net::IpAddr;
use std::net::SocketAddr;
Expand Down Expand Up @@ -164,34 +164,34 @@ where
.context("Error while closing SOCKS stream")
}

/// Type alias for the isolation information associated with a given SOCKS
/// connection _before_ SOCKS is negotiated.
///
/// Currently this is an index for which listener accepted the connection, plus
/// the address of the client that connected to the Socks port.
type ConnIsolation = (usize, IpAddr);

/// A Key used to isolate connections.
///
/// Composed of an usize (representing which listener socket accepted
/// the connection, the source IpAddr of the client, and the
/// authentication string provided by the client).
#[derive(Debug, Clone, PartialEq, Eq)]
struct SocksIsolationKey(ConnIsolation, SocksAuth);

impl arti_client::isolation::IsolationHelper for SocksIsolationKey {
fn compatible_same_type(&self, other: &Self) -> bool {
self == other
}

fn join_same_type(&self, other: &Self) -> Option<Self> {
if self == other {
Some(self.clone())
} else {
None
}
}
}
// /// Type alias for the isolation information associated with a given SOCKS
// /// connection _before_ SOCKS is negotiated.
// ///
// /// Currently this is an index for which listener accepted the connection, plus
// /// the address of the client that connected to the Socks port.
// type ConnIsolation = (usize, IpAddr);
//
// /// A Key used to isolate connections.
// ///
// /// Composed of an usize (representing which listener socket accepted
// /// the connection, the source IpAddr of the client, and the
// /// authentication string provided by the client).
// #[derive(Debug, Clone, PartialEq, Eq)]
// struct SocksIsolationKey(ConnIsolation, SocksAuth);
//
// impl arti_client::isolation::IsolationHelper for SocksIsolationKey {
// fn compatible_same_type(&self, other: &Self) -> bool {
// self == other
// }
//
// fn join_same_type(&self, other: &Self) -> Option<Self> {
// if self == other {
// Some(self.clone())
// } else {
// None
// }
// }
// }

/// Payload to return when an HTTP connection arrive on a Socks port
const WRONG_PROTOCOL_PAYLOAD: &[u8] = br#"HTTP/1.0 501 Tor is not an HTTP Proxy
Expand Down
2 changes: 1 addition & 1 deletion crates/obfs4/src/bin/lyrebird/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ where

fn resolve_target_addr(addr: &TargetAddr) -> Result<Option<SocketAddr>> {
match addr {
TargetAddr::Ip(sa) => Ok(Some(sa.clone())),
TargetAddr::Ip(sa) => Ok(Some(*sa)),
TargetAddr::Domain(_, _) => {
ptrs::resolve_addr(Some(format!("{addr}"))).context("domain resolution failed")
}
Expand Down

0 comments on commit a37deec

Please sign in to comment.