pub struct ListenerOrigins { /* private fields */ }Expand description
The names and origins one listener answers to, computed once from the address it holds.
Implementations§
Source§impl ListenerOrigins
impl ListenerOrigins
Sourcepub fn of(local: SocketAddr) -> Self
pub fn of(local: SocketAddr) -> Self
The names a listener bound to local answers to.
Sourcepub fn routed(local: SocketAddr, public: &str) -> Self
pub fn routed(local: SocketAddr, public: &str) -> Self
The names the remote listener bound to local answers to: its
loopback names, and the host of public, the https:// address
its route gave (wire D56).
Sourcepub fn url(&self) -> &str
pub fn url(&self) -> &str
The address a person on this machine opens: http://127.0.0.1:<port>
for a loopback or every-interface listener. One spelling, because a
browser keeps its device key per origin and a second spelling of
the same listener is a second origin with no key in it.
Sourcepub fn admits_host(&self, host: &str) -> bool
pub fn admits_host(&self, host: &str) -> bool
Whether host, as a request’s Host header spells it, names this
listener.
Sourcepub fn admits_origin(&self, origin: &str, host: &str) -> bool
pub fn admits_origin(&self, origin: &str, host: &str) -> bool
Whether origin is one of this listener’s own, for a request whose
admitted Host is host.
A named listener admits any of its origins; a listener on every interface admits only the origin of the host the request was sent to, because “any IP literal” would let a page on another machine of the network in.