Skip to content

Commit

Permalink
Update auth.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
0x676e67 committed May 14, 2024
1 parent 9d48d4c commit de085e2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/proxy/socks5/server/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,10 @@ impl Auth for NoAuth {

async fn execute(&self, stream: &mut TcpStream) -> Self::Output {
let socket = stream.peer_addr()?;
let is_equal = self.contains(socket.ip());
let resp = Response::new(if is_equal { Succeeded } else { Failed });
resp.write_to_async_stream(stream).await?;
if is_equal {
Ok(true)
} else {
Err(Error::new(ErrorKind::Other, "Ip is not in the whitelist"))
if !self.contains(socket.ip()) {
return Err(Error::new(ErrorKind::Other, "Ip is not in the whitelist"));
}
Ok(true)
}
}

Expand Down

0 comments on commit de085e2

Please sign in to comment.