mirror of
https://github.com/dndx/phantun.git
synced 2025-04-02 18:19:30 +08:00
style(fake-tcp): fix warnings
This commit is contained in:
parent
333c6dd059
commit
201da45ee8
@ -403,7 +403,7 @@ impl Stack {
|
|||||||
/// the connection attempt failed.
|
/// the connection attempt failed.
|
||||||
pub async fn connect(&mut self, addr: SocketAddr) -> Option<Socket> {
|
pub async fn connect(&mut self, addr: SocketAddr) -> Option<Socket> {
|
||||||
let mut rng = SmallRng::from_os_rng();
|
let mut rng = SmallRng::from_os_rng();
|
||||||
for local_port in rng.gen_range(32768..=60999)..=60999 {
|
for local_port in rng.random_range(32768..=60999)..=60999 {
|
||||||
let local_addr = SocketAddr::new(
|
let local_addr = SocketAddr::new(
|
||||||
if addr.is_ipv4() {
|
if addr.is_ipv4() {
|
||||||
IpAddr::V4(self.local_ip)
|
IpAddr::V4(self.local_ip)
|
||||||
|
@ -15,7 +15,7 @@ pub enum IPPacket<'p> {
|
|||||||
V6(ipv6::Ipv6Packet<'p>),
|
V6(ipv6::Ipv6Packet<'p>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> IPPacket<'a> {
|
impl IPPacket<'_> {
|
||||||
pub fn get_source(&self) -> IpAddr {
|
pub fn get_source(&self) -> IpAddr {
|
||||||
match self {
|
match self {
|
||||||
IPPacket::V4(p) => IpAddr::V4(p.get_source()),
|
IPPacket::V4(p) => IpAddr::V4(p.get_source()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user