mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-20 13:59:10 +00:00
minor changes
This commit is contained in:
parent
92011edd43
commit
ba1615fcd1
1 changed files with 4 additions and 3 deletions
|
@ -10,7 +10,8 @@ use std::net::{IpAddr, SocketAddr, ToSocketAddrs};
|
||||||
#[command(author, version, about = "Tunnel interface to proxy.", long_about = None)]
|
#[command(author, version, about = "Tunnel interface to proxy.", long_about = None)]
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
/// Proxy URL in the form proto://[username[:password]@]host:port,
|
/// Proxy URL in the form proto://[username[:password]@]host:port,
|
||||||
/// where proto is one of socks4, socks5, http. For example:
|
/// where proto is one of socks4, socks5, http.
|
||||||
|
/// Username and password are encoded in percent encoding. For example:
|
||||||
/// socks5://myname:password@127.0.0.1:1080
|
/// socks5://myname:password@127.0.0.1:1080
|
||||||
#[arg(short, long, value_parser = ArgProxy::from_url, value_name = "URL")]
|
#[arg(short, long, value_parser = ArgProxy::from_url, value_name = "URL")]
|
||||||
pub proxy: ArgProxy,
|
pub proxy: ArgProxy,
|
||||||
|
@ -327,8 +328,8 @@ impl ArgProxy {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
use percent_encoding::percent_decode;
|
use percent_encoding::percent_decode;
|
||||||
let username = percent_decode(url.username().as_bytes()).decode_utf8().unwrap();
|
let username = percent_decode(url.username().as_bytes()).decode_utf8()?;
|
||||||
let password = percent_decode(url.password().unwrap_or("").as_bytes()).decode_utf8().unwrap();
|
let password = percent_decode(url.password().unwrap_or("").as_bytes()).decode_utf8()?;
|
||||||
Some(UserKey::new(username, password))
|
Some(UserKey::new(username, password))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue