#[cfg(feature = "async-io")]
pub mod async_io;
#[cfg(feature = "tokio")]
pub mod tokio;
use futures::io::{AsyncRead, AsyncWrite};
use futures::future::BoxFuture;
use ipnet::IpNet;
use std::task::{Context, Poll};
use std::{fmt, io};
use std::net::{SocketAddr, TcpListener, TcpStream};
pub enum IfEvent {
Up(IpNet),
Down(IpNet),
}
pub struct Incoming<S> {
pub stream: S,
pub local_addr: SocketAddr,
pub remote_addr: SocketAddr,
}
pub trait Provider: Clone + Send + 'static {
type Stream: AsyncRead + AsyncWrite + Send + Unpin + fmt::Debug;
type Listener: Send + Unpin;
type IfWatcher: Send + Unpin;
fn if_watcher() -> BoxFuture<'static, io::Result<Self::IfWatcher>>;
fn new_listener(_: TcpListener) -> io::Result<Self::Listener>;
fn new_stream(_: TcpStream) -> BoxFuture<'static, io::Result<Self::Stream>>;
fn poll_accept(_: &mut Self::Listener, _: &mut Context<'_>) -> Poll<io::Result<Incoming<Self::Stream>>>;
fn poll_interfaces(_: &mut Self::IfWatcher, _: &mut Context<'_>) -> Poll<io::Result<IfEvent>>;
}