turmoil/net/
mod.rs
1use std::net::SocketAddr;
7
8pub mod tcp;
9pub use tcp::{listener::TcpListener, stream::TcpStream};
10
11pub(crate) mod udp;
12pub use udp::UdpSocket;
13
14#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)]
15pub(crate) struct SocketPair {
16 pub(crate) local: SocketAddr,
17 pub(crate) remote: SocketAddr,
18}
19
20impl SocketPair {
21 pub(crate) fn new(local: SocketAddr, remote: SocketAddr) -> SocketPair {
22 assert_ne!(local, remote);
23 SocketPair { local, remote }
24 }
25}