pub struct InternalNetworkGuard { /* private fields */ }Expand description
Guard that blocks SSRF targeting internal/private network addresses.
Inspects network egress actions and denies requests to private, loopback, link-local, and cloud metadata addresses.
Implementations§
Source§impl InternalNetworkGuard
impl InternalNetworkGuard
Sourcepub fn with_config(
extra_blocked_hosts: Vec<String>,
dns_rebinding_detection: bool,
) -> Self
pub fn with_config( extra_blocked_hosts: Vec<String>, dns_rebinding_detection: bool, ) -> Self
Create a new guard with additional blocked hostnames and DNS rebinding detection toggle.
Sourcepub fn check_host(&self, host: &str) -> Option<String>
pub fn check_host(&self, host: &str) -> Option<String>
Check whether a host string targets an internal/private address.
Returns Some(reason) if blocked, None if allowed.
Trait Implementations§
Source§impl Default for InternalNetworkGuard
impl Default for InternalNetworkGuard
Auto Trait Implementations§
impl Freeze for InternalNetworkGuard
impl RefUnwindSafe for InternalNetworkGuard
impl Send for InternalNetworkGuard
impl Sync for InternalNetworkGuard
impl Unpin for InternalNetworkGuard
impl UnsafeUnpin for InternalNetworkGuard
impl UnwindSafe for InternalNetworkGuard
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