Update tun2proxy.rs

This commit is contained in:
ssrlive 2023-03-23 23:21:22 +08:00 committed by GitHub
parent 2540daa423
commit d5fdf845bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))
}
}