mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +00:00
udp: clean up
This commit is contained in:
parent
f3e41148fe
commit
6bd63c2f5d
2 changed files with 0 additions and 29 deletions
|
|
@ -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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
|
||||||
pub enum IpVersion {
|
|
||||||
IPv4,
|
|
||||||
IPv6,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
||||||
pub struct AnnounceInterval(pub i32);
|
pub struct AnnounceInterval(pub i32);
|
||||||
|
|
||||||
|
|
@ -48,17 +42,6 @@ pub struct ResponsePeerIpv6 {
|
||||||
pub port: Port,
|
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)]
|
#[cfg(test)]
|
||||||
impl quickcheck::Arbitrary for InfoHash {
|
impl quickcheck::Arbitrary for InfoHash {
|
||||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue