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 0.7.0: 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 destination<A: ToAddress>(&mut self, value: A) -> &mut Self
pub fn destination<A: ToAddress>(&mut self, value: A) -> &mut Self
Set the destination address.
Sourcepub fn queues(&mut self, value: usize) -> &mut Self
👎Deprecated since 0.7.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 tun 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
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
Source§fn default() -> Configuration
fn default() -> Configuration
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Configuration
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnwindSafe for Configuration
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