#[non_exhaustive]pub struct IpStackConfig {
pub mtu: u16,
pub packet_information: bool,
pub tcp_config: Arc<TcpConfig>,
pub udp_timeout: Duration,
}Expand description
Configuration for the IP stack.
This structure holds configuration parameters that control the behavior of the IP stack, including network settings and protocol-specific timeouts.
§Examples
use ipstack::IpStackConfig;
use std::time::Duration;
let mut config = IpStackConfig::default();
config.mtu(1500).expect("Failed to set MTU")
.udp_timeout(Duration::from_secs(60))
.packet_information(false);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.mtu: u16Maximum Transmission Unit (MTU) size in bytes.
Default is MIN_MTU (1280).
packet_information: boolWhether to include packet information headers (Unix platforms only).
Default is false.
tcp_config: Arc<TcpConfig>TCP-specific configuration parameters.
udp_timeout: DurationTimeout for UDP connections. Default is 30 seconds.
Implementations§
Source§impl IpStackConfig
impl IpStackConfig
Sourcepub fn with_tcp_config(&mut self, config: TcpConfig) -> &mut Self
pub fn with_tcp_config(&mut self, config: TcpConfig) -> &mut Self
Sourcepub fn udp_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn udp_timeout(&mut self, timeout: Duration) -> &mut Self
Sourcepub fn mtu(&mut self, mtu: u16) -> Result<&mut Self, IpStackError>
pub fn mtu(&mut self, mtu: u16) -> Result<&mut Self, IpStackError>
Sourcepub fn mtu_unchecked(&mut self, mtu: u16) -> &mut Self
pub fn mtu_unchecked(&mut self, mtu: u16) -> &mut Self
Set the Maximum Transmission Unit (MTU) size without validation.
Sourcepub fn packet_information(&mut self, packet_information: bool) -> &mut Self
pub fn packet_information(&mut self, packet_information: bool) -> &mut Self
Enable or disable packet information headers (Unix platforms only).
When enabled on Unix platforms, the TUN device will include 4-byte packet information headers.
§Arguments
packet_information- Whether to include packet information headers
§Examples
use ipstack::IpStackConfig;
let mut config = IpStackConfig::default();
config.packet_information(true);Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpStackConfig
impl RefUnwindSafe for IpStackConfig
impl Send for IpStackConfig
impl Sync for IpStackConfig
impl Unpin for IpStackConfig
impl UnwindSafe for IpStackConfig
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