Skip to content

Commit

Permalink
Bump version 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Oct 3, 2024
1 parent eb6c8dc commit 8b0070d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tun2"
version = "3.1.5"
version = "3.1.6"
edition = "2021"
authors = ["meh. <[email protected]>", "@ssrlive"]
license = "WTFPL"
Expand Down
10 changes: 2 additions & 8 deletions src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ impl<'a> ToAddress for &'a Ipv4Addr {

impl ToAddress for IpAddr {
fn to_address(&self) -> Result<IpAddr> {
match self {
IpAddr::V4(value) => Ok(IpAddr::V4(*value)),
IpAddr::V6(value) => Ok(IpAddr::V6(*value)),
}
Ok(*self)
}
}

Expand All @@ -110,10 +107,7 @@ impl<'a> ToAddress for &'a SocketAddrV4 {

impl ToAddress for SocketAddr {
fn to_address(&self) -> Result<IpAddr> {
match self {
SocketAddr::V4(value) => Ok(IpAddr::V4(*value.ip())),
SocketAddr::V6(value) => Ok(IpAddr::V6(*value.ip())),
}
Ok(self.ip())
}
}

Expand Down
10 changes: 2 additions & 8 deletions src/platform/windows/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ impl AbstractDevice for Device {
let addresses = tun.session.get_adapter().get_addresses()?;
addresses
.iter()
.find_map(|a| match a {
std::net::IpAddr::V4(a) => Some(std::net::IpAddr::V4(*a)),
_ => None,
})
.find_map(|a| Some(*a))
.ok_or(Error::InvalidConfig)
}
Driver::Tap(_tap) => unimplemented!(),
Expand Down Expand Up @@ -196,10 +193,7 @@ impl AbstractDevice for Device {
.get_adapter()
.get_gateways()?
.iter()
.find_map(|a| match a {
std::net::IpAddr::V4(a) => Some(std::net::IpAddr::V4(*a)),
_ => None,
})
.find_map(|a| Some(*a))
.ok_or(Error::InvalidConfig),
Driver::Tap(_tap) => unimplemented!(),
}
Expand Down

0 comments on commit 8b0070d

Please sign in to comment.