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,5 +5,5 @@
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::doc_markdown)]
pub mod protocols;
pub mod error;
pub mod protocols;

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

@ -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 rfc6052;
pub mod packet_handler;
pub mod rfc6052;

View File

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