Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xmh0511 committed Sep 10, 2024
1 parent ba51991 commit f0c5c55
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions examples/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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::<IpAddr>()
// .unwrap(),
// "ffff:ffff:ffff:ffff::".parse::<IpAddr>().unwrap(),
// )
.address_with_prefix((10, 0, 0, 9), 24u8)
.address_with_prefix(
"CDCD:910A:2222:5498:8475:1111:3900:2020"
.parse::<IpAddr>()
.unwrap(),
"ffff:ffff:ffff:ffff::".parse::<IpAddr>().unwrap(),
)
//.address_with_prefix((10, 0, 0, 9), 24u8)
.destination((10, 0, 0, 1))
.up();

Expand All @@ -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::<IpAddr>()
// .unwrap(),
// "ffff:ffff:ffff:ffff::".parse::<IpAddr>().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::<IpAddr>()
.unwrap(),
"ffff:ffff:ffff:ffff::".parse::<IpAddr>().unwrap(),
None,
)?;
quit.recv().expect("Quit error.");
println!("recv quit!!!!!");
println!("{:?}", dev_t.address()?);
Expand Down

0 comments on commit f0c5c55

Please sign in to comment.