Implement TunInterfaceOptions

This commit is contained in:
dav 2023-06-24 09:24:19 -07:00 committed by David Zhong
parent da065b503f
commit 84f1d91d5c
6 changed files with 83 additions and 9 deletions

View file

@ -15,7 +15,7 @@ mod sys;
pub use super::queue::TunQueue;
use super::{ifname_to_string, string_to_ifname};
use super::{ifname_to_string, string_to_ifname, TunInterfaceOptions};
use kern_control::SysControlSocket;
#[derive(Debug)]
@ -26,6 +26,11 @@ pub struct TunInterface {
impl TunInterface {
#[throws]
pub fn new() -> TunInterface {
Self::new_with_options(TunInterfaceOptions::new())?
}
#[throws]
pub fn new_with_options(_: TunInterfaceOptions) -> TunInterface {
TunInterface::connect(0)?
}