pub struct ChannelSecurityConfig { /* private fields */ }Expand description
Configuration for channel security
Implementations§
Source§impl ChannelSecurityConfig
impl ChannelSecurityConfig
Sourcepub fn new() -> ChannelSecurityConfig
pub fn new() -> ChannelSecurityConfig
Create a new configuration
Sourcepub fn require_https_everywhere() -> ChannelSecurityConfig
pub fn require_https_everywhere() -> ChannelSecurityConfig
Require HTTPS for all paths (strict mode)
Sourcepub fn require_https(self, patterns: &[&str]) -> ChannelSecurityConfig
pub fn require_https(self, patterns: &[&str]) -> ChannelSecurityConfig
Add paths that require HTTPS
Sourcepub fn allow_http(self, patterns: &[&str]) -> ChannelSecurityConfig
pub fn allow_http(self, patterns: &[&str]) -> ChannelSecurityConfig
Add paths that allow HTTP
Sourcepub fn allow_any(self, patterns: &[&str]) -> ChannelSecurityConfig
pub fn allow_any(self, patterns: &[&str]) -> ChannelSecurityConfig
Add paths that allow any channel
Sourcepub fn default_requirement(
self,
requirement: ChannelRequirement,
) -> ChannelSecurityConfig
pub fn default_requirement( self, requirement: ChannelRequirement, ) -> ChannelSecurityConfig
Set the default requirement for paths not matching any rule
Sourcepub fn port_mapper(
self,
http_port: u16,
https_port: u16,
) -> ChannelSecurityConfig
pub fn port_mapper( self, http_port: u16, https_port: u16, ) -> ChannelSecurityConfig
Set custom port mapping
Sourcepub fn redirect_status(self, status: StatusCode) -> ChannelSecurityConfig
pub fn redirect_status(self, status: StatusCode) -> ChannelSecurityConfig
Set the HTTP redirect status code (default: 301 Moved Permanently)
Common values:
- 301: Moved Permanently (cached by browsers)
- 302: Found (temporary redirect)
- 307: Temporary Redirect (preserves method)
- 308: Permanent Redirect (preserves method, cached)
Sourcepub fn temporary_redirect(self) -> ChannelSecurityConfig
pub fn temporary_redirect(self) -> ChannelSecurityConfig
Use temporary redirect (302 Found)
Sourcepub fn permanent_redirect_preserve_method(self) -> ChannelSecurityConfig
pub fn permanent_redirect_preserve_method(self) -> ChannelSecurityConfig
Use permanent redirect that preserves HTTP method (308)
Sourcepub fn preserve_host(self, preserve: bool) -> ChannelSecurityConfig
pub fn preserve_host(self, preserve: bool) -> ChannelSecurityConfig
Set whether to preserve the Host header in redirects
Trait Implementations§
Source§impl Clone for ChannelSecurityConfig
impl Clone for ChannelSecurityConfig
Source§fn clone(&self) -> ChannelSecurityConfig
fn clone(&self) -> ChannelSecurityConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 ChannelSecurityConfig
impl Debug for ChannelSecurityConfig
Source§impl Default for ChannelSecurityConfig
impl Default for ChannelSecurityConfig
Source§fn default() -> ChannelSecurityConfig
fn default() -> ChannelSecurityConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ChannelSecurityConfig
impl RefUnwindSafe for ChannelSecurityConfig
impl Send for ChannelSecurityConfig
impl Sync for ChannelSecurityConfig
impl Unpin for ChannelSecurityConfig
impl UnwindSafe for ChannelSecurityConfig
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more