pub struct SocketConfig {
pub bind_addr: Option<SocketAddr>,
pub bind_to_device: Option<String>,
pub mark: Option<u32>,
pub ttl: Option<u32>,
}Expand description
Local UDP socket options used by ClientConfig.
These settings affect how the client binds and sends from the socket. They do not change the IRTT protocol parameters negotiated with the server.
§Example
Bind to a chosen local endpoint and set the outgoing IPv4 TTL:
use std::net::{Ipv4Addr, SocketAddr};
use irtt_client::{AddressFamily, ClientConfig, SocketConfig};
let config = ClientConfig {
address_family: AddressFamily::Ipv4,
socket: SocketConfig {
bind_addr: Some(SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))),
ttl: Some(32),
..SocketConfig::default()
},
..ClientConfig::default()
};
assert_eq!(config.socket.ttl, Some(32));
assert_eq!(config.address_family, AddressFamily::Ipv4);Fields§
§bind_addr: Option<SocketAddr>Local address to bind before connecting the UDP socket.
None binds to an unspecified address with an ephemeral port matching
the selected remote address family.
bind_to_device: Option<String>Network interface to bind this socket to (SO_BINDTODEVICE).
mark: Option<u32>Firewall mark applied to outgoing packets (SO_MARK).
ttl: Option<u32>Optional IPv4 TTL or IPv6 hop limit applied to sent packets.
None leaves the platform default unchanged. Values must fit in the
platform socket option range; MAX_TTL is the public configuration
bound used by this crate.
Trait Implementations§
Source§impl Clone for SocketConfig
impl Clone for SocketConfig
Source§impl Debug for SocketConfig
impl Debug for SocketConfig
Source§impl Default for SocketConfig
impl Default for SocketConfig
impl Eq for SocketConfig
Source§impl PartialEq for SocketConfig
impl PartialEq for SocketConfig
impl StructuralPartialEq for SocketConfig
Auto Trait Implementations§
impl Freeze for SocketConfig
impl RefUnwindSafe for SocketConfig
impl Send for SocketConfig
impl Sync for SocketConfig
impl Unpin for SocketConfig
impl UnsafeUnpin for SocketConfig
impl UnwindSafe for SocketConfig
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