From f0c5c5544bb6c10273c0044dd8d6c2054415faca Mon Sep 17 00:00:00 2001 From: xmh0511 <970252187@qq.com> Date: Tue, 10 Sep 2024 20:50:22 +0800 Subject: [PATCH] update --- examples/read.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/examples/read.rs b/examples/read.rs index b5654bb..3fe1c79 100644 --- a/examples/read.rs +++ b/examples/read.rs @@ -5,6 +5,7 @@ use std::sync::Arc; use tun_rs::{AbstractDevice, BoxError}; #[cfg(any(target_os = "windows", target_os = "linux", target_os = "freebsd",))] +#[allow(unused_imports)] use tun_rs::Layer; fn main() -> Result<(), BoxError> { @@ -41,13 +42,13 @@ fn main_entry(quit: Receiver<()>) -> Result<(), BoxError> { // config.layer(Layer::L2); config - // .address_with_prefix( - // "CDCD:910A:2222:5498:8475:1111:3900:2020" - // .parse::() - // .unwrap(), - // "ffff:ffff:ffff:ffff::".parse::().unwrap(), - // ) - .address_with_prefix((10, 0, 0, 9), 24u8) + .address_with_prefix( + "CDCD:910A:2222:5498:8475:1111:3900:2020" + .parse::() + .unwrap(), + "ffff:ffff:ffff:ffff::".parse::().unwrap(), + ) + //.address_with_prefix((10, 0, 0, 9), 24u8) .destination((10, 0, 0, 1)) .up(); @@ -62,14 +63,14 @@ fn main_entry(quit: Receiver<()>) -> Result<(), BoxError> { #[allow(unreachable_code)] Ok::<(), BoxError>(()) }); - dev_t.set_network_address((10, 0, 0, 88), (255, 255, 255, 0), None)?; - // dev_t.set_network_address( - // "CDCD:910A:2222:5498:8475:1111:3900:2024" - // .parse::() - // .unwrap(), - // "ffff:ffff:ffff:ffff::".parse::().unwrap(), - // None, - // )?; + //dev_t.set_network_address((10, 0, 0, 88), (255, 255, 255, 0), None)?; + dev_t.set_network_address( + "CDCD:910A:2222:5498:8475:1111:3900:2024" + .parse::() + .unwrap(), + "ffff:ffff:ffff:ffff::".parse::().unwrap(), + None, + )?; quit.recv().expect("Quit error."); println!("recv quit!!!!!"); println!("{:?}", dev_t.address()?);