clippy
This commit is contained in:
@@ -67,7 +67,7 @@ impl OutboundRequestFilter {
|
|||||||
|
|
||||||
async fn check_standard_list(&self, host: &RequestHost) -> bool {
|
async fn check_standard_list(&self, host: &RequestHost) -> bool {
|
||||||
let guard = self.standard_list.get().await;
|
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 {
|
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 {
|
async fn check_request_host(&mut self, request_host: &RequestHost) -> bool {
|
||||||
// first check our own allow list
|
// 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 it's locally allowed, no point in checking the standard list
|
||||||
if local_allowed {
|
if local_allowed {
|
||||||
@@ -114,7 +114,7 @@ impl OutboundRequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if that failed, check the standard list
|
// 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.
|
/// 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)
|
self.data.contains_ip_network(network)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub(super) fn add_host<H: Into<Host>>(&mut self, host: H) {
|
pub(super) fn add_host<H: Into<Host>>(&mut self, host: H) {
|
||||||
match host.into() {
|
match host.into() {
|
||||||
Host::Domain(domain) => self.add_domain(&domain),
|
Host::Domain(domain) => self.add_domain(&domain),
|
||||||
@@ -67,6 +68,7 @@ impl HostsStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub(super) fn add_ipnet(&mut self, network: IpNetwork) {
|
pub(super) fn add_ipnet(&mut self, network: IpNetwork) {
|
||||||
if !self.contains_ipnetwork(network) {
|
if !self.contains_ipnetwork(network) {
|
||||||
self.data.add_ipnet(network);
|
self.data.add_ipnet(network);
|
||||||
@@ -111,9 +113,9 @@ impl HostsStore {
|
|||||||
let parent_dir = file
|
let parent_dir = file
|
||||||
.parent()
|
.parent()
|
||||||
.expect("parent dir does not exist for {file:?}");
|
.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:?}"));
|
.unwrap_or_else(|_| panic!("could not create storage directory at {parent_dir:?}"));
|
||||||
File::create(&file).unwrap();
|
File::create(file).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user