pub struct LocalNodeClient { /* private fields */ }Implementations§
Source§impl LocalNodeClient
impl LocalNodeClient
pub async fn connect( endpoint: impl AsRef<Path>, expected_node_id: &NodeId, role: ClientRole, access_token: &str, ) -> Result<Self, NodeClientError>
pub async fn connect_loopback( endpoint: SocketAddr, expected_node_id: &NodeId, role: ClientRole, access_token: &str, ) -> Result<Self, NodeClientError>
Sourcepub async fn adopt(
stream: impl NodeClientStream + 'static,
expected_node_id: &NodeId,
role: ClientRole,
access_token: &str,
) -> Result<Self, NodeClientError>
pub async fn adopt( stream: impl NodeClientStream + 'static, expected_node_id: &NodeId, role: ClientRole, access_token: &str, ) -> Result<Self, NodeClientError>
Runs the client handshake over a stream the caller already opened – or, on a call-home relay, one it ACCEPTED.
Identical to what Self::connect and Self::connect_loopback
do after their own connect call: same hello, same mutual
challenge-response over both nonces, same compatibility
negotiation. The direction the socket was opened in is not an input
to any of it, and this constructor is the proof of that – it is
the same code path, entered one step later.
expected_node_id still has to be known up front, because the
server proof is computed from that node’s own access token. On a
call-home connection the relay learns it from the node’s
NodeCallHomeAnnounce preface, which selects a token and nothing
else – see that type’s own doc comment.
pub fn hello(&self) -> &NodeHello
pub async fn send( &mut self, request: NodeRequest, ) -> Result<u64, NodeClientError>
pub async fn recv(&mut self) -> Result<ServerFrame, NodeClientError>
pub async fn request( &mut self, request: NodeRequest, ) -> Result<NodeResponse, NodeClientError>
pub fn take_event(&mut self) -> Option<NodeEventEnvelope>
Auto Trait Implementations§
impl !Sync for LocalNodeClient
impl Freeze for LocalNodeClient
impl RefUnwindSafe for LocalNodeClient
impl Send for LocalNodeClient
impl Unpin for LocalNodeClient
impl UnsafeUnpin for LocalNodeClient
impl UnwindSafe for LocalNodeClient
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
Mutably borrows from an owned value. Read more