Struct ya_relay_stack::Network
source · pub struct Network {
pub name: Rc<String>,
pub config: Rc<StackConfig>,
pub stack: Stack<'static>,
/* private fields */
}Fields§
§name: Rc<String>§config: Rc<StackConfig>§stack: Stack<'static>Implementations§
source§impl Network
impl Network
sourcepub fn new(
name: impl ToString,
config: Rc<StackConfig>,
stack: Stack<'static>
) -> Self
pub fn new(
name: impl ToString,
config: Rc<StackConfig>,
stack: Stack<'static>
) -> Self
Creates a new Network instance
sourcepub fn get_bound(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Option<SocketHandle>
pub fn get_bound(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Option<SocketHandle>
Returns a socket bound on an endpoint
sourcepub fn bind(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Result<SocketHandle>
pub fn bind(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Result<SocketHandle>
Listen on a local endpoint
sourcepub fn unbind(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Result<()>
pub fn unbind(
&self,
protocol: Protocol,
endpoint: impl Into<SocketEndpoint>
) -> Result<()>
Stop listening on a local endpoint
sourcepub fn connect(
&self,
remote: impl Into<IpEndpoint>,
timeout: impl Into<Duration>
) -> LocalBoxFuture<'_, Result<Connection>>
pub fn connect(
&self,
remote: impl Into<IpEndpoint>,
timeout: impl Into<Duration>
) -> LocalBoxFuture<'_, Result<Connection>>
Initiate a TCP connection
sourcepub fn disconnect_all(
&self,
remote_ip: Box<[u8]>,
timeout: impl Into<Duration>
) -> LocalBoxFuture<'_, ()>
pub fn disconnect_all(
&self,
remote_ip: Box<[u8]>,
timeout: impl Into<Duration>
) -> LocalBoxFuture<'_, ()>
Close all TCP connections with a remote IP address
pub fn sockets(&self) -> Vec<(SocketDesc, SocketState<ChannelMetrics>)>
pub fn metrics(&self) -> ChannelMetrics
sourcepub fn send<'a>(
&self,
data: impl Into<Payload>,
connection: Connection
) -> impl Future<Output = Result<()>> + 'a
pub fn send<'a>(
&self,
data: impl Into<Payload>,
connection: Connection
) -> impl Future<Output = Result<()>> + 'a
Inject send data into the stack
pub fn spawn_local(&self)
sourcepub fn ingress_receiver(&self) -> Option<IngressReceiver>
pub fn ingress_receiver(&self) -> Option<IngressReceiver>
Take the ingress traffic receive channel
sourcepub fn egress_receiver(&self) -> Option<EgressReceiver>
pub fn egress_receiver(&self) -> Option<EgressReceiver>
Take the egress traffic receive channel