pub struct Target {
pub addr: SocketAddr,
pub transport: TransportKind,
pub verify_as: Option<Arc<str>>,
pub path: Option<Arc<str>>,
}Expand description
A destination.
Not Copy, because of verify_as. That field is the reason this type exists rather than a
bare (SocketAddr, TransportKind): the address says where to send, while the original URI host
says which TLS identity to verify and which HTTP authority a WebSocket handshake must name.
Deriving either from the resolved address loses authority information before the connection.
Fields§
§addr: SocketAddrWhere to send.
transport: TransportKindHow to send.
verify_as: Option<Arc<str>>Original URI host before resolution: TLS/WSS verification name and WS/WSS HTTP authority. For clear WS it is authority only; no certificate verification is implied.
path: Option<Arc<str>>The resource the WebSocket handshake asks for. None means /, and None outside
WebSocket, where there is no handshake to ask anything of.
Implementations§
Source§impl Target
impl Target
Sourcepub fn new(addr: SocketAddr, transport: TransportKind) -> Self
pub fn new(addr: SocketAddr, transport: TransportKind) -> Self
A destination.
Sourcepub fn udp(addr: SocketAddr) -> Self
pub fn udp(addr: SocketAddr) -> Self
A UDP destination.
Sourcepub fn verifying(self, name: impl AsRef<str>) -> Self
pub fn verifying(self, name: impl AsRef<str>) -> Self
The same destination, with its pre-resolution URI host.
TLS/WSS verify certificates against it. WS/WSS also put it in the HTTP Host authority;
clear WS uses that authority without implying authentication.
Sourcepub fn at_path(self, path: impl AsRef<str>) -> Self
pub fn at_path(self, path: impl AsRef<str>) -> Self
The same destination, with the resource its WebSocket handshake asks for.
RFC 7118 §5 registers a subprotocol and a set of framing rules; it says nothing at all
about where on a server SIP lives. A server is therefore entitled to serve it from /,
from /ws, or from its own HTTP server on another port, and a client that can only ask
for / reaches the first kind and none of the others.
A leading / is supplied when it is missing, because a resource name that lacks one is
not a relative path in a request-target — it runs into the authority and silently sends
the upgrade somewhere nobody meant. Anything after the path is kept as given: a server
that wants a query string gets the one it was handed.
Sourcepub fn connection(&self) -> ConnectionKey
pub fn connection(&self) -> ConnectionKey
Which pooled connection carries traffic for this destination.
Trait Implementations§
impl Eq for Target
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl Freeze for Target
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnsafeUnpin for Target
impl UnwindSafe for Target
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more