Start Tun Interface at Daemon Command
This commit is contained in:
parent
347b78453f
commit
ede0d13bca
9 changed files with 83 additions and 52 deletions
|
|
@ -33,8 +33,14 @@ impl TunInterface {
|
|||
|
||||
#[throws]
|
||||
#[instrument]
|
||||
pub fn new_with_options(_: TunOptions) -> TunInterface {
|
||||
TunInterface::connect(0)?
|
||||
pub fn new_with_options(options: TunOptions) -> TunInterface {
|
||||
let ti = TunInterface::connect(0)?;
|
||||
if let Some(addr) = options.address{
|
||||
if let Ok(addr) = addr.parse() {
|
||||
ti.set_ipv4_addr(addr)?;
|
||||
}
|
||||
}
|
||||
ti
|
||||
}
|
||||
|
||||
#[throws]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue