tobaru 0.7.1

Port forwarding CLI utility written in Rust with allowlists, TLS SNI and ALPN routing, round-robin forwarding (load balancing), IP-to-destination mapping, and iptables support.
1
2
3
4
5
6
7
8
9
10
11
use tokio::net::{lookup_host, ToSocketAddrs};

pub async fn resolve_host<T>(host: T) -> std::io::Result<std::net::SocketAddr>
where
    T: ToSocketAddrs,
{
    lookup_host(host)
        .await?
        .next()
        .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::Other, "Unable to resolve host"))
}