pub struct ProxyFilter { /* private fields */ }Expand description
Async wrapper around HostFilter that performs DNS resolution.
Implementations§
Source§impl ProxyFilter
impl ProxyFilter
Sourcepub fn new(allowed_hosts: &[String]) -> Self
pub fn new(allowed_hosts: &[String]) -> Self
Create a new proxy filter with the given allowed hosts.
Sourcepub async fn check_host(&self, host: &str, port: u16) -> Result<CheckResult>
pub async fn check_host(&self, host: &str, port: u16) -> Result<CheckResult>
Check a host against the filter with async DNS resolution.
Resolves the hostname to IP addresses, then checks all resolved IPs against the link-local deny range (cloud metadata SSRF protection). If any resolved IP is link-local, the request is blocked.
On success, returns both the filter result and the resolved socket
addresses. Callers MUST use resolved_addrs to connect to the upstream
instead of re-resolving the hostname, eliminating the DNS rebinding
TOCTOU window.
Sourcepub fn check_host_with_ips(
&self,
host: &str,
resolved_ips: &[IpAddr],
) -> FilterResult
pub fn check_host_with_ips( &self, host: &str, resolved_ips: &[IpAddr], ) -> FilterResult
Check a host with pre-resolved IPs (no DNS lookup).
Sourcepub fn allowed_count(&self) -> usize
pub fn allowed_count(&self) -> usize
Number of allowed hosts configured.
Trait Implementations§
Source§impl Clone for ProxyFilter
impl Clone for ProxyFilter
Source§fn clone(&self) -> ProxyFilter
fn clone(&self) -> ProxyFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProxyFilter
impl RefUnwindSafe for ProxyFilter
impl Send for ProxyFilter
impl Sync for ProxyFilter
impl Unpin for ProxyFilter
impl UnsafeUnpin for ProxyFilter
impl UnwindSafe for ProxyFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more