move cidr_range_denylist from globals to client service

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-03 07:35:48 +00:00
parent 9d9f403ad5
commit c01b049910
6 changed files with 28 additions and 32 deletions

View file

@ -358,7 +358,7 @@ impl super::Service {
}
pub(crate) fn validate_ip(&self, ip: &IPAddress) -> Result<()> {
if !self.services.globals.valid_cidr_range(ip) {
if !self.services.client.valid_cidr_range(ip) {
return Err!(BadServerResponse("Not allowed to send requests to this IP"));
}

View file

@ -9,7 +9,7 @@ use std::{fmt::Write, sync::Arc};
use conduit::{Result, Server};
use self::{cache::Cache, dns::Resolver};
use crate::{client, globals, Dep};
use crate::{client, Dep};
pub struct Service {
pub cache: Arc<Cache>,
@ -20,7 +20,6 @@ pub struct Service {
struct Services {
server: Arc<Server>,
client: Dep<client::Service>,
globals: Dep<globals::Service>,
}
impl crate::Service for Service {
@ -33,7 +32,6 @@ impl crate::Service for Service {
services: Services {
server: args.server.clone(),
client: args.depend::<client::Service>("client"),
globals: args.depend::<globals::Service>("globals"),
},
}))
}