pub struct Exposed { /* private fields */ }Expand description
A service’s one outbound socket to a relay: what it serves there, and
the calls it makes over it. Cheap to clone; Self::serve holds a weak
reference, so the socket goes with the last clone (or Self::stop).
Implementations§
Source§impl Exposed
impl Exposed
Sourcepub fn new(opts: DialOut) -> Self
pub fn new(opts: DialOut) -> Self
Not dialed until Self::serve: an activation that calls out through
the relay holds a clone of this before it is served.
Sourcepub fn with_first_contact<F, Fut>(
self,
known_hosts: impl Into<PathBuf>,
ask: F,
) -> Self
pub fn with_first_contact<F, Fut>( self, known_hosts: impl Into<PathBuf>, ask: F, ) -> Self
NEST-25: first contact, ssh’s way. With no DialOut::trust, the
host’s key is the one known_hosts pins for the URL; when none is,
the host proves a key at _info and nothing more is sent or served
until ask — shown that key, its fingerprint and the pairing code —
says yes, which pins it there. A host presenting another key than
the one pinned is refused, and ask is not asked. trust still wins
(the strict mode).
Sourcepub fn with_known_hosts(self, known_hosts: impl Into<PathBuf>) -> Self
pub fn with_known_hosts(self, known_hosts: impl Into<PathBuf>) -> Self
NEST-25: trust what known_hosts pins for the URL, and refuse a host
with no key there (no first contact).
Sourcepub fn with_pending_for(self, wait: Duration) -> Self
pub fn with_pending_for(self, wait: Duration) -> Self
NEST-25: how long an offer the host holds pending is waited for, on the same socket (the pairing code is the connection’s). Default 10 min.
Sourcepub fn pending(&self) -> Option<String>
pub fn pending(&self) -> Option<String>
NEST-25: the pairing code while the host holds this side’s offer pending, waiting for its operator.
Sourcepub fn code(&self) -> Option<String>
pub fn code(&self) -> Option<String>
NEST-25: the pairing code of the connection now (or the last one).
Sourcepub fn principal(&self) -> Result<String, String>
pub fn principal(&self) -> Result<String, String>
The principal this side signs in as (its key’s), or why the key does not read.
Sourcepub async fn mounted(&self, timeout: Duration) -> Result<String, String>
pub async fn mounted(&self, timeout: Duration) -> Result<String, String>
Wait until mounted (its path at the relay), or refused, or timeout.
Sourcepub fn serve<A: Activation + Clone>(&self, activation: A)
pub fn serve<A: Activation + Clone>(&self, activation: A)
Dial, offer activation, serve it; dial again whenever the socket
drops. Replaces a previous serve.
Sourcepub async fn call(&self, method: &str, params: Value) -> PlexusStream
pub async fn call(&self, method: &str, params: Value) -> PlexusStream
Call method (a path at the relay: peers.bob.hello, peers.list)
over this side’s socket, as this side’s key: {svc}.call, decided by
the relay’s gate. Not connected: one child_unavailable item.