mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-21 16:41:01 +00:00
Squashed code beautifications
commitd5fdf845bf
Author: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu Mar 23 23:21:22 2023 +0800 Update tun2proxy.rs commit2540daa423
Author: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu Mar 23 22:40:26 2023 +0800 Update main.rs commit9ef5efb864
Author: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu Mar 23 22:19:06 2023 +0800 Update main.rs commit017ea1a17a
Author: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu Mar 23 22:15:00 2023 +0800 Update main.rs
This commit is contained in:
parent
d13c7ff61b
commit
8be40a1fbd
2 changed files with 10 additions and 11 deletions
|
@ -13,10 +13,11 @@ struct Args {
|
|||
tun: String,
|
||||
|
||||
/// The proxy URL in the form proto://[username[:password]@]host:port
|
||||
#[arg(short, long = "proxy", value_parser = Proxy::from_url, value_name = "URL")]
|
||||
#[arg(short, long, value_parser = Proxy::from_url, value_name = "URL")]
|
||||
proxy: Proxy,
|
||||
|
||||
#[arg(short, long = "dns")]
|
||||
/// Enable virtual DNS feature
|
||||
#[arg(short = 'd', long = "dns")]
|
||||
virtual_dns: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -48,15 +48,13 @@ pub(crate) struct Destination {
|
|||
impl TryFrom<Destination> for SocketAddr {
|
||||
type Error = Error;
|
||||
fn try_from(value: Destination) -> Result<Self, Self::Error> {
|
||||
Ok(SocketAddr::new(
|
||||
match value.host {
|
||||
DestinationHost::Address(addr) => addr,
|
||||
Hostname(e) => {
|
||||
return Err(e.into());
|
||||
}
|
||||
},
|
||||
value.port,
|
||||
))
|
||||
let ip = match value.host {
|
||||
DestinationHost::Address(addr) => addr,
|
||||
Hostname(e) => {
|
||||
return Err(e.into());
|
||||
}
|
||||
};
|
||||
Ok(SocketAddr::new(ip, value.port))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue