1

Apply rustfmt fixes

This commit is contained in:
Evan Pratten 2023-08-03 12:21:59 -04:00
parent 0d627d430b
commit 079416b3eb
11 changed files with 18 additions and 16 deletions

View File

@ -5,4 +5,4 @@
#![allow(clippy::missing_panics_doc)]
mod tun;
pub use tun::Tun;
pub use tun::Tun;

View File

@ -108,4 +108,4 @@ mod tests {
assert_eq!(bimap.get_right(&3), None);
assert_eq!(bimap.get_left(&"three"), None);
}
}
}

View File

@ -91,4 +91,4 @@ impl Default for NetworkAddressTable {
timeouts: FxHashMap::default(),
}
}
}
}

View File

@ -10,4 +10,4 @@ pub enum MaybeTimeout {
duration: Duration,
start: std::time::Instant,
},
}
}

View File

@ -5,5 +5,5 @@
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::doc_markdown)]
pub mod error;
pub mod protocols;
pub mod error;

View File

@ -2,7 +2,8 @@
use super::{
icmp::{translate_icmp_to_icmpv6, translate_icmpv6_to_icmp},
tcp::{recalculate_tcp_checksum_ipv4, recalculate_tcp_checksum_ipv6}, udp::{recalculate_udp_checksum_ipv6, recalculate_udp_checksum_ipv4},
tcp::{recalculate_tcp_checksum_ipv4, recalculate_tcp_checksum_ipv6},
udp::{recalculate_udp_checksum_ipv4, recalculate_udp_checksum_ipv6},
};
use crate::error::{Error, Result};
use pnet::packet::{
@ -127,7 +128,11 @@ pub fn translate_ipv6_to_ipv4(
});
ipv4_packet.set_source(new_source);
ipv4_packet.set_destination(new_destination);
ipv4_packet.set_total_length((Ipv4Packet::minimum_packet_size() + new_payload.len()).try_into().unwrap());
ipv4_packet.set_total_length(
(Ipv4Packet::minimum_packet_size() + new_payload.len())
.try_into()
.unwrap(),
);
// Copy the payload to the buffer
ipv4_packet.set_payload(&new_payload);

View File

@ -1,4 +1,4 @@
pub mod icmp;
pub mod ip;
pub mod tcp;
pub mod udp;
pub mod icmp;

View File

@ -4,4 +4,4 @@
pub enum Error {
#[error("Invalid IPv6 prefix length: {0}. Must be one of 32, 40, 48, 56, 64, or 96")]
InvalidPrefixLength(u8),
}
}

View File

@ -5,12 +5,12 @@
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::missing_safety_doc)]
pub mod link;
pub mod ip;
pub mod link;
pub mod route;
/// Get a handle on a new rtnetlink connection
#[cfg(feature="tokio")]
#[cfg(feature = "tokio")]
pub fn new_handle() -> Result<rtnetlink::Handle, std::io::Error> {
let (rt_connection, rt_handle, _) = rtnetlink::new_connection().map_err(|err| {
log::error!("Failed to open rtnetlink connection");

View File

@ -1,5 +1,5 @@
//! Common code used across all protomask binaries
pub mod logging;
pub mod packet_handler;
pub mod rfc6052;
pub mod packet_handler;

View File

@ -1,5 +1,2 @@
#[tokio::main]
pub async fn main(){
}
pub async fn main() {}