pub struct Link { /* private fields */ }Expand description
A handshaked link to one station. Cloning it shares the link.
Implementations§
Source§impl Link
impl Link
Sourcepub async fn put_record(&self, wire: &[u8]) -> Result<(), LinkError>
pub async fn put_record(&self, wire: &[u8]) -> Result<(), LinkError>
Stores a signed record, as its wire bytes, in the station’s DHT.
Sourcepub async fn find_record(&self, key: &[u8; 32]) -> Result<Verified, LinkError>
pub async fn find_record(&self, key: &[u8; 32]) -> Result<Verified, LinkError>
The record stored under key, verified.
Sourcepub async fn find_records(
&self,
key: &[u8; 32],
) -> Result<(Vec<Verified>, usize), LinkError>
pub async fn find_records( &self, key: &[u8; 32], ) -> Result<(Vec<Verified>, usize), LinkError>
Every record stored under key that verifies, and how many the
station returned that did not.
Sourcepub async fn find_records_by_type(
&self,
t: RecordType,
) -> Result<(Vec<Verified>, usize), LinkError>
pub async fn find_records_by_type( &self, t: RecordType, ) -> Result<(Vec<Verified>, usize), LinkError>
Every record of type t the station holds that verifies, and how many
it returned that did not.
Source§impl Link
impl Link
Sourcepub async fn publish(&self, p: Publication) -> Result<(), LinkError>
pub async fn publish(&self, p: Publication) -> Result<(), LinkError>
Signs p as a PUBLISH and sends it.
Sourcepub async fn publish_signed(
&self,
p: &SignedPublication,
) -> Result<(), LinkError>
pub async fn publish_signed( &self, p: &SignedPublication, ) -> Result<(), LinkError>
Sends a publication signed once for several links, as it is.
Source§impl Link
impl Link
Sourcepub async fn serve(&self, o: Offer) -> Result<Served, LinkError>
pub async fn serve(&self, o: Offer) -> Result<Served, LinkError>
Advertises o’s procedure on the link and answers its CALLs until
stopped. For an org procedure it resolves the org directory and this
node’s procedure delegation from the DHT; a procedure in this node’s
own namespace needs neither, and another node’s namespace is refused.
It signs the advertisement with this node’s identity key, naming the
connected station as the serving station and living no longer than
the records it carries nor 5 minutes, and checks its authorization
(against the realm key for an org procedure) before sending it in an
ADVERTISE and putting it in the DHT. The advertisement is renewed at
half its lifetime.
Source§impl Link
impl Link
Sourcepub async fn open_stream(&self, c: StreamCall) -> Result<Stream, LinkError>
pub async fn open_stream(&self, c: StreamCall) -> Result<Stream, LinkError>
Opens a streaming session: a QUIC stream of its own, on which it writes the signed STREAM_OPEN. A stream it opens but cannot write the open on is released before the error returns.
Source§impl Link
impl Link
Sourcepub async fn dial(cfg: Config) -> Result<Link, LinkError>
pub async fn dial(cfg: Config) -> Result<Link, LinkError>
Dials cfg.target, runs the v4 handshake as a client, and returns the
link once the station’s HELLO accepts it, within
HANDSHAKE_TIMEOUT.
Sourcepub fn station_node_id(&self) -> [u8; 32]
pub fn station_node_id(&self) -> [u8; 32]
The node_id of the station the link reached.
Sourcepub fn station_capabilities(&self) -> u64
pub fn station_capabilities(&self) -> u64
The capability bits the station’s HELLO announced.