pub enum ProxyPolicy {
PreferProxy,
RequireProxy,
RequireProxyExceptLocal,
Custom(Arc<dyn Fn(&TargetAddr) -> Route + Sync + Send>),
}Expand description
Decides, per target, whether a connection must, may or must not use the proxy.
Variants§
PreferProxy
Use the proxy when one is configured, otherwise connect directly. (Route::PreferProxy
for every target.)
RequireProxy
Every connection must go through the proxy. (Route::Proxy for every target.)
RequireProxyExceptLocal
Targets for which TargetAddr::is_local holds are connected directly (a remote proxy
usually cannot reach this machine’s LAN); every other target must use the proxy.
Custom(Arc<dyn Fn(&TargetAddr) -> Route + Sync + Send>)
A custom rule.
Implementations§
Source§impl ProxyPolicy
impl ProxyPolicy
Sourcepub fn custom(
f: impl Fn(&TargetAddr) -> Route + Send + Sync + 'static,
) -> ProxyPolicy
pub fn custom( f: impl Fn(&TargetAddr) -> Route + Send + Sync + 'static, ) -> ProxyPolicy
Builds a ProxyPolicy::Custom from a closure.
Sourcepub fn route(&self, target: &TargetAddr) -> Route
pub fn route(&self, target: &TargetAddr) -> Route
The route this policy selects for target.
Trait Implementations§
Source§impl Clone for ProxyPolicy
impl Clone for ProxyPolicy
Source§fn clone(&self) -> ProxyPolicy
fn clone(&self) -> ProxyPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProxyPolicy
impl Debug for ProxyPolicy
Source§impl Default for ProxyPolicy
impl Default for ProxyPolicy
Source§fn default() -> ProxyPolicy
fn default() -> ProxyPolicy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ProxyPolicy
impl !UnwindSafe for ProxyPolicy
impl Forget for ProxyPolicy
impl Freeze for ProxyPolicywhere
*const ArcInner<dyn Fn(&TargetAddr) -> Route + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&TargetAddr) -> Route + Sync + Send>>: Freeze,
impl Move for ProxyPolicy
impl Send for ProxyPolicy
impl Sync for ProxyPolicy
impl Unpin for ProxyPolicy
impl UnsafeUnpin for ProxyPolicywhere
*const ArcInner<dyn Fn(&TargetAddr) -> Route + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&TargetAddr) -> Route + Sync + Send>>: UnsafeUnpin,
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