pub struct AbusePolicy {
pub burst: Option<Limit>,
pub route_quotas: Vec<RouteQuota>,
pub global: Option<Limit>,
pub trusted: Vec<String>,
pub exempt_routes: Vec<String>,
}Expand description
Abuse controls. Every part is optional.
Fields§
§burst: Option<Limit>Per-client burst limit.
route_quotas: Vec<RouteQuota>Per-client quotas for named routes.
global: Option<Limit>Limit across all clients; trusted clients are exempt.
trusted: Vec<String>Trusted clients: IP addresses or CIDR blocks such as
10.0.0.0/8 or fd00::/8.
exempt_routes: Vec<String>Routes the policy does not apply to.
Implementations§
Source§impl AbusePolicy
impl AbusePolicy
Sourcepub fn validate(&self) -> Result<(), AbuseError>
pub fn validate(&self) -> Result<(), AbuseError>
Checks limits, trusted entries and quotas.
§Errors
Returns an AbuseError for a zero limit, an unparsable
trusted entry, or two quotas for one route.
Trait Implementations§
Source§impl Clone for AbusePolicy
impl Clone for AbusePolicy
Source§impl Debug for AbusePolicy
impl Debug for AbusePolicy
Source§impl Default for AbusePolicy
impl Default for AbusePolicy
Source§impl<'de> Deserialize<'de> for AbusePolicywhere
AbusePolicy: Default,
impl<'de> Deserialize<'de> for AbusePolicywhere
AbusePolicy: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for AbusePolicy
Source§impl PartialEq for AbusePolicy
impl PartialEq for AbusePolicy
Source§impl Serialize for AbusePolicy
impl Serialize for AbusePolicy
impl StructuralPartialEq for AbusePolicy
Auto Trait Implementations§
impl Forget for AbusePolicy
impl Freeze for AbusePolicy
impl RefUnwindSafe for AbusePolicy
impl Send for AbusePolicy
impl Sync for AbusePolicy
impl Unpin for AbusePolicy
impl UnsafeUnpin for AbusePolicy
impl UnwindSafe for AbusePolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.