Skip to content

Commit

Permalink
Bump version 0.5.10
Browse files Browse the repository at this point in the history
ssrlive committed Feb 11, 2024
1 parent 09b41a3 commit 0ec2abb
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "socks5-impl"
version = "0.5.9"
version = "0.5.10"
authors = ["ssrlive <[email protected]>"]
description = "Fundamental abstractions and async read / write functions for SOCKS5 protocol and Relatively low-level asynchronized SOCKS5 server implementation based on tokio"
categories = ["network-programming", "asynchronous"]
@@ -24,7 +24,7 @@ thiserror = "1.0"
tokio = { version = "1.36", features = ["full"], optional = true }

[dev-dependencies]
clap = { version = "4.4", features = ["derive"] }
clap = { version = "4.5", features = ["derive"] }
ctrlc2 = { version = "3.5", features = ["tokio", "termination"] }
dotenvy = "0.15"
env_logger = "0.11"
11 changes: 11 additions & 0 deletions src/protocol/handshake/password_method/mod.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,17 @@ pub struct UserKey {
pub password: String,
}

impl std::fmt::Display for UserKey {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match (self.username.is_empty(), self.password.is_empty()) {
(true, true) => write!(f, ""),
(true, false) => write!(f, ":{}", self.password),
(false, true) => write!(f, "{}", self.username),
(false, false) => write!(f, "{}:{}", self.username, self.password),
}
}
}

impl UserKey {
/// Constructs `UserKey` with the specified username and a password.
pub fn new<U, P>(username: U, password: P) -> Self

0 comments on commit 0ec2abb

Please sign in to comment.