Skip to content

Commit

Permalink
Clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Dec 2, 2024
1 parent adc7c4b commit 24ba2a4
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions talpid-core/src/firewall/macos.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
use super::{FirewallArguments, FirewallPolicy};
use std::env;
use std::io;
use std::net::{IpAddr, Ipv4Addr};
use std::ptr;

use ipnetwork::IpNetwork;
use libc::{c_int, sysctlbyname};
use pfctl::{DropAction, FilterRuleAction, Ip, Uid};
use std::{
env, io,
net::{IpAddr, Ipv4Addr},
ptr,
};
use subslice::SubsliceExt;
use talpid_types::net::{
self, AllowedEndpoint, AllowedTunnelTraffic, ALLOWED_LAN_MULTICAST_NETS, ALLOWED_LAN_NETS,
AllowedEndpoint, AllowedTunnelTraffic, TransportProtocol, ALLOWED_LAN_MULTICAST_NETS,
ALLOWED_LAN_NETS,
};

use super::{FirewallArguments, FirewallPolicy};

pub use pfctl::Error;

type Result<T> = std::result::Result<T, Error>;
Expand Down Expand Up @@ -530,10 +532,7 @@ impl Firewall {
Ok(rules)
}

fn get_allow_relay_rule(
&self,
relay_endpoint: &net::AllowedEndpoint,
) -> Result<pfctl::FilterRule> {
fn get_allow_relay_rule(&self, relay_endpoint: &AllowedEndpoint) -> Result<pfctl::FilterRule> {
let pfctl_proto = as_pfctl_proto(relay_endpoint.endpoint.protocol);

let mut builder = self.create_rule_builder(FilterRuleAction::Pass);
Expand Down Expand Up @@ -941,10 +940,10 @@ impl Firewall {
}
}

fn as_pfctl_proto(protocol: net::TransportProtocol) -> pfctl::Proto {
fn as_pfctl_proto(protocol: TransportProtocol) -> pfctl::Proto {
match protocol {
net::TransportProtocol::Udp => pfctl::Proto::Udp,
net::TransportProtocol::Tcp => pfctl::Proto::Tcp,
TransportProtocol::Udp => pfctl::Proto::Udp,
TransportProtocol::Tcp => pfctl::Proto::Tcp,
}
}

Expand Down

0 comments on commit 24ba2a4

Please sign in to comment.