This commit is contained in:
Jędrzej Stuczyński
2023-03-31 15:56:21 +01:00
parent 605f8fcde3
commit 276edfd562
2 changed files with 7 additions and 5 deletions
@@ -67,7 +67,7 @@ impl OutboundRequestFilter {
async fn check_standard_list(&self, host: &RequestHost) -> bool {
let guard = self.standard_list.get().await;
self.check_group(&*guard, host)
self.check_group(&guard, host)
}
fn check_group(&self, group: &HostsGroup, host: &RequestHost) -> bool {
@@ -106,7 +106,7 @@ impl OutboundRequestFilter {
async fn check_request_host(&mut self, request_host: &RequestHost) -> bool {
// first check our own allow list
let local_allowed = self.check_allowed_hosts(&request_host).await;
let local_allowed = self.check_allowed_hosts(request_host).await;
// if it's locally allowed, no point in checking the standard list
if local_allowed {
@@ -114,7 +114,7 @@ impl OutboundRequestFilter {
}
// if that failed, check the standard list
self.check_standard_list(&request_host).await
self.check_standard_list(request_host).await
}
/// Returns `true` if a host's root domain is in the `allowed_hosts` list.
@@ -60,6 +60,7 @@ impl HostsStore {
self.data.contains_ip_network(network)
}
#[allow(unused)]
pub(super) fn add_host<H: Into<Host>>(&mut self, host: H) {
match host.into() {
Host::Domain(domain) => self.add_domain(&domain),
@@ -67,6 +68,7 @@ impl HostsStore {
}
}
#[allow(unused)]
pub(super) fn add_ipnet(&mut self, network: IpNetwork) {
if !self.contains_ipnetwork(network) {
self.data.add_ipnet(network);
@@ -111,9 +113,9 @@ impl HostsStore {
let parent_dir = file
.parent()
.expect("parent dir does not exist for {file:?}");
fs::create_dir_all(&parent_dir)
fs::create_dir_all(parent_dir)
.unwrap_or_else(|_| panic!("could not create storage directory at {parent_dir:?}"));
File::create(&file).unwrap();
File::create(file).unwrap();
}
}