mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-07 23:27:46 +00:00
Update tun2proxy.rs
This commit is contained in:
parent
2540daa423
commit
d5fdf845bf
1 changed files with 7 additions and 9 deletions
|
@ -48,15 +48,13 @@ pub(crate) struct Destination {
|
||||||
impl TryFrom<Destination> for SocketAddr {
|
impl TryFrom<Destination> for SocketAddr {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
fn try_from(value: Destination) -> Result<Self, Self::Error> {
|
fn try_from(value: Destination) -> Result<Self, Self::Error> {
|
||||||
Ok(SocketAddr::new(
|
let ip = match value.host {
|
||||||
match value.host {
|
|
||||||
DestinationHost::Address(addr) => addr,
|
DestinationHost::Address(addr) => addr,
|
||||||
Hostname(e) => {
|
Hostname(e) => {
|
||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
value.port,
|
Ok(SocketAddr::new(ip, value.port))
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue