pub struct ProxyConfig {
pub timeout: Duration,
pub max_body_size: usize,
}Expand description
Configuration for proxy behavior and upstream communication.
Controls timeouts and request size limits for proxied requests.
§Example
use std::time::Duration;
use wisegate_core::ProxyConfig;
let config = ProxyConfig {
timeout: Duration::from_secs(30),
max_body_size: ProxyConfig::mb_to_bytes(100),
};
assert!(config.is_valid());
assert_eq!(config.max_body_size_mb(), "100");Fields§
§timeout: DurationTimeout for upstream requests
max_body_size: usizeMaximum request body size in bytes (0 = unlimited)
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if the configuration is valid.
A valid configuration has a non-zero timeout.
Sourcepub fn max_body_size_mb(&self) -> String
pub fn max_body_size_mb(&self) -> String
Returns the maximum body size formatted for display.
Returns “unlimited” if max_body_size is 0, otherwise returns the size in MB.
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§fn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
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 moreAuto Trait Implementations§
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnsafeUnpin for ProxyConfig
impl UnwindSafe for ProxyConfig
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