pub enum PeerFilter {
All,
Subnets(Vec<IpNet>),
Custom(Box<dyn Fn(SocketAddr) -> bool + Send + Sync>),
}Expand description
Peer connection filter for super::TcpServer.
Controls which incoming connections are allowed through the proxy.
Variants§
All
Allow all incoming connections.
Subnets(Vec<IpNet>)
Allow connections from one or more IP subnets.
Custom(Box<dyn Fn(SocketAddr) -> bool + Send + Sync>)
Allow connections based on custom logic.
The function receives the peer’s socket address and returns
true to allow the connection or false to reject it.
Implementations§
Source§impl PeerFilter
impl PeerFilter
Sourcepub fn is_allowed(&self, addr: SocketAddr) -> bool
pub fn is_allowed(&self, addr: SocketAddr) -> bool
Check whether a peer address is allowed by this filter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PeerFilter
impl !RefUnwindSafe for PeerFilter
impl Send for PeerFilter
impl Sync for PeerFilter
impl Unpin for PeerFilter
impl UnsafeUnpin for PeerFilter
impl !UnwindSafe for PeerFilter
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