Struct HttpAclBuilder

Source
pub struct HttpAclBuilder { /* private fields */ }
Expand description

A builder for HttpAcl.

Implementations§

Source§

impl HttpAclBuilder

Source

pub fn new() -> Self

Create a new HttpAclBuilder.

Source

pub fn http(self, allow: bool) -> Self

Sets whether HTTP is allowed.

Source

pub fn https(self, allow: bool) -> Self

Sets whether HTTPS is allowed.

Source

pub fn private_ip_ranges(self, allow: bool) -> Self

Sets whether private IP ranges are allowed.

Source

pub fn method_acl_default(self, allow: bool) -> Self

Set default action for HTTP methods if no ACL match is found.

Source

pub fn host_acl_default(self, allow: bool) -> Self

Set default action for hosts if no ACL match is found.

Source

pub fn port_acl_default(self, allow: bool) -> Self

Set default action for ports if no ACL match is found.

Source

pub fn ip_acl_default(self, allow: bool) -> Self

Set default action for IPs if no ACL match is found.

Source

pub fn header_acl_default(self, allow: bool) -> Self

Set default action for headers if no ACL match is found.

Source

pub fn url_path_acl_default(self, allow: bool) -> Self

Set default action for URL paths if no ACL match is found.

Source

pub fn add_allowed_method( self, method: impl Into<HttpRequestMethod>, ) -> Result<Self, AddError>

Adds a method to the allowed methods.

Source

pub fn remove_allowed_method(self, method: impl Into<HttpRequestMethod>) -> Self

Removes a method from the allowed methods.

Source

pub fn allowed_methods( self, methods: Vec<impl Into<HttpRequestMethod>>, ) -> Result<Self, AddError>

Sets the allowed methods.

Source

pub fn clear_allowed_methods(self) -> Self

Clears the allowed methods.

Source

pub fn add_denied_method( self, method: impl Into<HttpRequestMethod>, ) -> Result<Self, AddError>

Adds a method to the denied methods.

Source

pub fn remove_denied_method(self, method: impl Into<HttpRequestMethod>) -> Self

Removes a method from the denied methods.

Source

pub fn denied_methods( self, methods: Vec<impl Into<HttpRequestMethod>>, ) -> Result<Self, AddError>

Sets the denied methods.

Source

pub fn clear_denied_methods(self) -> Self

Clears the denied methods.

Source

pub fn add_allowed_host(self, host: String) -> Result<Self, AddError>

Sets whether public IP ranges are allowed.

Source

pub fn remove_allowed_host(self, host: String) -> Self

Removes a host from the allowed hosts.

Source

pub fn allowed_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>

Sets the allowed hosts.

Source

pub fn clear_allowed_hosts(self) -> Self

Clears the allowed hosts.

Source

pub fn add_denied_host(self, host: String) -> Result<Self, AddError>

Adds a host to the denied hosts.

Source

pub fn remove_denied_host(self, host: String) -> Self

Removes a host from the denied hosts.

Source

pub fn denied_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>

Sets the denied hosts.

Source

pub fn clear_denied_hosts(self) -> Self

Clears the denied hosts.

Source

pub fn add_allowed_port_range( self, port_range: RangeInclusive<u16>, ) -> Result<Self, AddError>

Adds a port range to the allowed port ranges.

Source

pub fn remove_allowed_port_range(self, port_range: RangeInclusive<u16>) -> Self

Removes a port range from the allowed port ranges.

Source

pub fn allowed_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>>, ) -> Result<Self, AddError>

Sets the allowed port ranges.

Source

pub fn clear_allowed_port_ranges(self) -> Self

Clears the allowed port ranges.

Source

pub fn add_denied_port_range( self, port_range: RangeInclusive<u16>, ) -> Result<Self, AddError>

Adds a port range to the denied port ranges.

Source

pub fn remove_denied_port_range(self, port_range: RangeInclusive<u16>) -> Self

Removes a port range from the denied port ranges.

Source

pub fn denied_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>>, ) -> Result<Self, AddError>

Sets the denied port ranges.

Source

pub fn clear_denied_port_ranges(self) -> Self

Clears the denied port ranges.

Source

pub fn add_allowed_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>

Adds an IP range to the allowed IP ranges.

Source

pub fn remove_allowed_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>

Removes an IP range from the allowed IP ranges.

Source

pub fn allowed_ip_ranges<Ip: IntoIpRange>( self, ip_ranges: Vec<Ip>, ) -> Result<Self, AddError>

Sets the allowed IP ranges.

Source

pub fn clear_allowed_ip_ranges(self) -> Self

Clears the allowed IP ranges.

Source

pub fn add_denied_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>

Adds an IP range to the denied IP ranges.

Source

pub fn remove_denied_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>

Removes an IP range from the denied IP ranges.

Source

pub fn denied_ip_ranges<Ip: IntoIpRange>( self, ip_ranges: Vec<Ip>, ) -> Result<Self, AddError>

Sets the denied IP ranges.

Source

pub fn clear_denied_ip_ranges(self) -> Self

Clears the denied IP ranges.

Source

pub fn add_static_dns_mapping( self, host: String, sock_addr: SocketAddr, ) -> Result<Self, AddError>

Add a static DNS mapping.

Source

pub fn remove_static_dns_mapping(self, host: &str) -> Self

Removes a static DNS mapping.

Source

pub fn static_dns_mappings( self, mappings: HashMap<String, SocketAddr>, ) -> Result<Self, AddError>

Sets the static DNS mappings.

Source

pub fn clear_static_dns_mappings(self) -> Self

Clears the static DNS mappings.

Source

pub fn add_allowed_header( self, header: String, value: Option<String>, ) -> Result<Self, AddError>

Adds a header to the allowed headers.

Source

pub fn remove_allowed_header(self, header: &str) -> Self

Removes a header from the allowed headers.

Source

pub fn allowed_headers( self, headers: HashMap<String, Option<String>>, ) -> Result<Self, AddError>

Sets the allowed headers.

Source

pub fn clear_allowed_headers(self) -> Self

Clears the allowed headers.

Source

pub fn add_denied_header( self, header: String, value: Option<String>, ) -> Result<Self, AddError>

Adds a header to the denied headers.

Source

pub fn remove_denied_header(self, header: &str) -> Self

Removes a header from the denied headers.

Source

pub fn denied_headers( self, headers: HashMap<String, Option<String>>, ) -> Result<Self, AddError>

Sets the denied headers.

Source

pub fn clear_denied_headers(self) -> Self

Clears the denied headers.

Source

pub fn add_allowed_url_path(self, url_path: String) -> Result<Self, AddError>

Adds a URL path to the allowed URL paths.

Source

pub fn remove_allowed_url_path(self, url_path: &str) -> Self

Removes a URL path from the allowed URL paths.

Source

pub fn allowed_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>

Sets the allowed URL paths.

Source

pub fn clear_allowed_url_paths(self) -> Self

Clears the allowed URL paths.

Source

pub fn add_denied_url_path(self, url_path: String) -> Result<Self, AddError>

Adds a URL path to the denied URL paths.

Source

pub fn remove_denied_url_path(self, url_path: &str) -> Self

Removes a URL path from the denied URL paths.

Source

pub fn denied_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>

Sets the denied URL paths.

Source

pub fn clear_denied_url_paths(self) -> Self

Clears the denied URL paths.

Source

pub fn build(self) -> HttpAcl

Builds the HttpAcl.

Source

pub fn build_full(self, validate_fn: Option<ValidateFn>) -> HttpAcl

Builds the HttpAcl.

Source

pub fn try_build_full( self, validate_fn: Option<ValidateFn>, ) -> Result<HttpAcl, AddError>

Builds the HttpAcl and returns an error if the configuration is invalid. This is used for deserialized ACLs as the URL Path Routers need to be built.

Source

pub fn try_build(self) -> Result<HttpAcl, AddError>

Builds the HttpAcl and returns an error if the configuration is invalid. This is used for deserialized ACLs as the URL Path Routers need to be built.

Trait Implementations§

Source§

impl Clone for HttpAclBuilder

Source§

fn clone(&self) -> HttpAclBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpAclBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpAclBuilder

Source§

fn default() -> HttpAclBuilder

Returns the “default value” for a type. Read more
Source§

impl PartialEq for HttpAclBuilder

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,