Skip to content

Commit 6f91457

Browse files
committed
socks5: fix host encoding
1 parent fe6d63e commit 6f91457

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

socks5-client/src/encoding.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,25 @@ impl Encoding for HostName {
185185
return ip.encode(writer);
186186
}
187187
#[cfg(feature = "dns")]
188-
HostName::Dns(name) => name.to_string(),
188+
HostName::Dns(name) => {
189+
DOMAIN.encode(writer)?;
190+
name.to_string()
191+
},
189192
#[cfg(feature = "tor")]
190-
HostName::Tor(addr) => addr.to_string(),
193+
HostName::Tor(addr) => {
194+
DOMAIN.encode(writer)?;
195+
addr.to_string()
196+
},
191197
#[cfg(feature = "i2p")]
192-
HostName::I2p(addr) => addr.to_string(),
198+
HostName::I2p(addr) => {
199+
DOMAIN.encode(writer)?;
200+
addr.to_string()
201+
},
193202
#[cfg(feature = "nym")]
194-
HostName::Nym(addr) => addr.to_string(),
203+
HostName::Nym(addr) => {
204+
DOMAIN.encode(writer)?;
205+
addr.to_string()
206+
},
195207
_ => return Err(EncodingError::AddrNotSupported),
196208
};
197209
let len =

0 commit comments

Comments
 (0)