udp: clean up

This commit is contained in:
Joakim Frostegård 2021-11-15 22:23:55 +01:00
parent f3e41148fe
commit 6bd63c2f5d
2 changed files with 0 additions and 29 deletions

View file

@ -269,18 +269,6 @@ impl Default for State {
}
}
}
pub fn ip_version_from_ip(ip: IpAddr) -> IpVersion {
match ip {
IpAddr::V4(_) => IpVersion::IPv4,
IpAddr::V6(ip) => {
if let [0, 0, 0, 0, 0, 0xffff, ..] = ip.segments() {
IpVersion::IPv4
} else {
IpVersion::IPv6
}
}
}
}
#[cfg(test)]
mod tests {

View file

@ -1,11 +1,5 @@
use std::net::{Ipv4Addr, Ipv6Addr};
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
pub enum IpVersion {
IPv4,
IPv6,
}
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
pub struct AnnounceInterval(pub i32);
@ -48,17 +42,6 @@ pub struct ResponsePeerIpv6 {
pub port: Port,
}
#[cfg(test)]
impl quickcheck::Arbitrary for IpVersion {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
if bool::arbitrary(g) {
IpVersion::IPv4
} else {
IpVersion::IPv6
}
}
}
#[cfg(test)]
impl quickcheck::Arbitrary for InfoHash {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {