Add rudimentary web server
This commit is contained in:
parent
12e53a4b2a
commit
a2cbd2ad77
6 changed files with 235 additions and 35 deletions
|
|
@ -5,6 +5,9 @@ pub struct TunInterface {
|
|||
inner: AsyncFd<crate::TunInterface>,
|
||||
}
|
||||
|
||||
unsafe impl Send for TunInterface {
|
||||
}
|
||||
|
||||
impl TunInterface {
|
||||
pub fn new(tun: crate::TunInterface) -> io::Result<Self> {
|
||||
Ok(Self {
|
||||
|
|
@ -62,16 +65,6 @@ impl TunInterface {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn set_name(&self, name: &str) -> io::Result<()> {
|
||||
loop {
|
||||
let mut guard = self.inner.readable().await?;
|
||||
match guard.try_io(|inner| inner.get_ref().set_name(name)) {
|
||||
Ok(result) => return result,
|
||||
Err(_would_block) => continue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn netmask(&self) -> io::Result<std::net::Ipv4Addr> {
|
||||
loop {
|
||||
let mut guard = self.inner.readable().await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue