pub struct Configuration { /* private fields */ }
Expand description
Configuration builder for a TUN interface.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn platform_config<F>(&mut self, f: F) -> &mut Selfwhere
F: FnOnce(&mut PlatformConfig),
pub fn platform_config<F>(&mut self, f: F) -> &mut Selfwhere
F: FnOnce(&mut PlatformConfig),
Access the platform-dependent configuration.
Sourcepub fn name<S: AsRef<str>>(&mut self, tun_name: S) -> &mut Self
👎Deprecated since 1.1.2: Since the API name
may have an easy name conflict when IDE prompts, it is replaced by tun_name
for better coding experience
pub fn name<S: AsRef<str>>(&mut self, tun_name: S) -> &mut Self
name
may have an easy name conflict when IDE prompts, it is replaced by tun_name
for better coding experienceFunctionally equivalent to tun_name
Sourcepub fn tun_name<S: AsRef<str>>(&mut self, tun_name: S) -> &mut Self
pub fn tun_name<S: AsRef<str>>(&mut self, tun_name: S) -> &mut Self
Set the tun name.
[Note: on macOS, the tun name must be the form utunx
where x
is a number, such as utun3
. – end note]
Sourcepub fn address<A: IntoAddress>(&mut self, value: A) -> &mut Self
pub fn address<A: IntoAddress>(&mut self, value: A) -> &mut Self
Set the address.
Sourcepub fn destination<A: IntoAddress>(&mut self, value: A) -> &mut Self
pub fn destination<A: IntoAddress>(&mut self, value: A) -> &mut Self
Set the destination address.
Sourcepub fn broadcast<A: IntoAddress>(&mut self, value: A) -> &mut Self
pub fn broadcast<A: IntoAddress>(&mut self, value: A) -> &mut Self
Set the broadcast address.
Sourcepub fn netmask<A: IntoAddress>(&mut self, value: A) -> &mut Self
pub fn netmask<A: IntoAddress>(&mut self, value: A) -> &mut Self
Set the netmask.
Sourcepub fn mtu(&mut self, value: u16) -> &mut Self
pub fn mtu(&mut self, value: u16) -> &mut Self
Set the MTU.
[Note: mtu on the Windows platform is always 65535 due to wintun – end note]
Sourcepub fn queues(&mut self, value: usize) -> &mut Self
👎Deprecated since 1.0.0: The queues will always be 1.
pub fn queues(&mut self, value: usize) -> &mut Self
Set the number of queues. Note: The queues must be 1, otherwise will failed.
Sourcepub fn close_fd_on_drop(&mut self, value: bool) -> &mut Self
pub fn close_fd_on_drop(&mut self, value: bool) -> &mut Self
Set whether to close the received raw file descriptor on drop or not. The default behaviour is to close the received or tun2 generated file descriptor. Note: If this is set to false, it is up to the caller to ensure the file descriptor that they pass via Configuration::raw_fd is properly closed.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more