pub enum Endpoint {
Udp(Addr, Port),
Tcp(Addr, Port),
Tls(Addr, Port),
Quic(Addr, Port),
Http(Url),
Https(Url),
Ws(Url),
Wss(Url),
Unix(PathBuf),
}Expand description
Endpoint defines generic network endpoints for karyon.
Transport schemes (TCP, UDP, TLS, QUIC, Unix) carry just address + port.
URL schemes (HTTP, HTTPS, WS, WSS) carry a full Url so path, query,
and other URL semantics are preserved.
§Example
use std::net::SocketAddr;
use karyon_net::Endpoint;
let endpoint: Endpoint = "tcp://127.0.0.1:3000".parse().unwrap();
let socketaddr: SocketAddr = "127.0.0.1:3000".parse().unwrap();
let endpoint = Endpoint::new_udp_addr(socketaddr);
let endpoint: Endpoint = "http://example.com:8080/rpc".parse().unwrap();Variants§
Udp(Addr, Port)
Tcp(Addr, Port)
Tls(Addr, Port)
Quic(Addr, Port)
Http(Url)
Https(Url)
Ws(Url)
Wss(Url)
Unix(PathBuf)
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new_tcp_addr(addr: SocketAddr) -> Endpoint
pub fn new_tcp_addr(addr: SocketAddr) -> Endpoint
Creates a new TCP endpoint from a SocketAddr.
Sourcepub fn new_udp_addr(addr: SocketAddr) -> Endpoint
pub fn new_udp_addr(addr: SocketAddr) -> Endpoint
Creates a new UDP endpoint from a SocketAddr.
Sourcepub fn new_tls_addr(addr: SocketAddr) -> Endpoint
pub fn new_tls_addr(addr: SocketAddr) -> Endpoint
Creates a new TLS endpoint from a SocketAddr.
Sourcepub fn new_quic_addr(addr: SocketAddr) -> Endpoint
pub fn new_quic_addr(addr: SocketAddr) -> Endpoint
Creates a new QUIC endpoint from a SocketAddr.
Sourcepub fn new_unix_addr(addr: &Path) -> Endpoint
pub fn new_unix_addr(addr: &Path) -> Endpoint
Creates a new Unix endpoint from a UnixSocketAddr.
Trait Implementations§
Source§impl ToEndpoint for Endpoint
impl ToEndpoint for Endpoint
fn to_endpoint(&self) -> Result<Endpoint>
Source§impl TryFrom<Endpoint> for SocketAddr
impl TryFrom<Endpoint> for SocketAddr
Source§impl TryFrom<Endpoint> for SocketAddr
Available on crate feature unix and target_family=unix only.
impl TryFrom<Endpoint> for SocketAddr
Available on crate feature
unix and target_family=unix only.impl Eq for Endpoint
impl StructuralPartialEq for Endpoint
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin for Endpoint
impl UnwindSafe for Endpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more