mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
style: Refactor remaining parts of admin service
This commit is contained in:
3 files changed
+344
-316
No files matched your search
+11
-10
@@ -1,6 +1,6 @@
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use conduwuit::{Config, Result, err, implement, trace};
|
||||
use conduwuit::{Config, Result, err, trace};
|
||||
use either::Either;
|
||||
use ipaddress::IPAddress;
|
||||
use reqwest::redirect;
|
||||
@@ -141,6 +141,16 @@ impl crate::Service for Service {
|
||||
fn name(&self) -> &str { service::make_name(std::module_path!()) }
|
||||
}
|
||||
|
||||
impl Service {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn valid_cidr_range(&self, ip: &IPAddress) -> bool {
|
||||
self.cidr_range_denylist
|
||||
.iter()
|
||||
.all(|cidr| !cidr.includes(ip))
|
||||
}
|
||||
}
|
||||
|
||||
fn base(config: &Config) -> Result<reqwest::ClientBuilder> {
|
||||
let mut builder = reqwest::Client::builder()
|
||||
.hickory_dns(true)
|
||||
@@ -227,12 +237,3 @@ fn builder_interface(
|
||||
Ok(builder)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[implement(Service)]
|
||||
pub fn valid_cidr_range(&self, ip: &IPAddress) -> bool {
|
||||
self.cidr_range_denylist
|
||||
.iter()
|
||||
.all(|cidr| !cidr.includes(ip))
|
||||
}
|
||||
Reference in new issue
Block a user