pub trait KitsuneHandler:
'static
+ Send
+ Sync
+ Debug {
// Required method
fn create_space(
&self,
space: SpaceId,
) -> BoxFut<'_, K2Result<DynSpaceHandler>>;
// Provided methods
fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()> { ... }
fn peer_disconnect(&self, peer: Url, reason: Option<String>) { ... }
fn preflight_gather_outgoing(&self, peer_url: Url) -> K2Result<Bytes> { ... }
fn preflight_validate_incoming(
&self,
peer_url: Url,
data: Bytes,
) -> K2Result<()> { ... }
}Expand description
Handler for events coming out of Kitsune2.
Required Methods§
Sourcefn create_space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpaceHandler>>
fn create_space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpaceHandler>>
Kitsune would like to construct a space. Provide a handler.
Provided Methods§
Sourcefn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
A notification that a new listening address has been bound. Peers should now go to this new address to reach this node.
Sourcefn peer_disconnect(&self, peer: Url, reason: Option<String>)
fn peer_disconnect(&self, peer: Url, reason: Option<String>)
A peer has disconnected from us. If they did so gracefully the reason will be is_some().
Sourcefn preflight_gather_outgoing(&self, peer_url: Url) -> K2Result<Bytes>
fn preflight_gather_outgoing(&self, peer_url: Url) -> K2Result<Bytes>
Gather preflight data to send to a new opening connection. Returning an Err result will close this connection.
The default implementation sends an empty preflight message.