pub trait NetIo {
// Required methods
fn bind_udp(
&self,
token: &GateToken,
addr: SocketAddr,
opts: UdpOpts,
) -> Result<UdpSocket>;
fn bind_mdns(
&self,
token: &GateToken,
hosts: &[IpAddr],
) -> Result<UdpSocket>;
fn bind_tcp(
&self,
token: &GateToken,
addr: SocketAddr,
) -> Result<TcpListener>;
fn connect_tcp<'a>(
&'a self,
token: &'a GateToken,
bind: Option<IpAddr>,
to: SocketAddr,
host: Option<&'a str>,
) -> LocalBoxFuture<'a, Result<TcpStream>>;
fn resolve<'a>(
&'a self,
token: &'a GateToken,
host: &'a str,
port: u16,
) -> LocalBoxFuture<'a, Result<Vec<SocketAddr>>>;
fn route_probe(&self, peer: IpAddr) -> Option<IpAddr>;
}Expand description
The socket factory.
Required Methods§
Sourcefn bind_udp(
&self,
token: &GateToken,
addr: SocketAddr,
opts: UdpOpts,
) -> Result<UdpSocket>
fn bind_udp( &self, token: &GateToken, addr: SocketAddr, opts: UdpOpts, ) -> Result<UdpSocket>
A non-blocking UDP socket bound on addr (port 0: any). token
allowed a ReachKind::Bind on addr’s IP.
Sourcefn bind_mdns(&self, token: &GateToken, hosts: &[IpAddr]) -> Result<UdpSocket>
fn bind_mdns(&self, token: &GateToken, hosts: &[IpAddr]) -> Result<UdpSocket>
The mDNS socket: 0.0.0.0:5353 with address (and port) reuse, so it
shares the port with the host’s own responder, in the mDNS group on
each IPv4 address of hosts (or the default interface). See
mdns_socket. token allowed the
ReachKind::Mdns bind on 0.0.0.0.
Sourcefn bind_tcp(&self, token: &GateToken, addr: SocketAddr) -> Result<TcpListener>
fn bind_tcp(&self, token: &GateToken, addr: SocketAddr) -> Result<TcpListener>
A TCP listener on addr (an IPv6 one IPv6-only). token allowed a
ReachKind::Bind on addr’s IP.
Sourcefn connect_tcp<'a>(
&'a self,
token: &'a GateToken,
bind: Option<IpAddr>,
to: SocketAddr,
host: Option<&'a str>,
) -> LocalBoxFuture<'a, Result<TcpStream>>
fn connect_tcp<'a>( &'a self, token: &'a GateToken, bind: Option<IpAddr>, to: SocketAddr, host: Option<&'a str>, ) -> LocalBoxFuture<'a, Result<TcpStream>>
A TCP connection to to, from bind (port 0) when given (the engine
passes only a bind of to’s family). host is the name to was
resolved from, when there is one (a TURN server’s). token allowed
to: a ReachKind::TcpDial (ICE-TCP) or
a ReachKind::IceServerResolved
(a TURN server over TCP / TLS).
Sourcefn resolve<'a>(
&'a self,
token: &'a GateToken,
host: &'a str,
port: u16,
) -> LocalBoxFuture<'a, Result<Vec<SocketAddr>>>
fn resolve<'a>( &'a self, token: &'a GateToken, host: &'a str, port: u16, ) -> LocalBoxFuture<'a, Result<Vec<SocketAddr>>>
Resolves host (an ICE server URL’s host: a name, an IP literal, or a
bracketed IPv6 literal) and port. token allowed the
ReachKind::IceServer question for
host and port.
Sourcefn route_probe(&self, peer: IpAddr) -> Option<IpAddr>
fn route_probe(&self, peer: IpAddr) -> Option<IpAddr>
The local IP the OS sends to peer from: a connected UDP probe (no
datagram leaves the machine), or None.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".