Skip to main content

connect

Function connect 

Source
pub async fn connect(
    host: &str,
    port: u16,
    trust: Trust,
    identity: &KeyPair,
) -> Result<Session, HandshakeError>
Expand description

Dial host:port and complete the full CONNECT/HELLO handshake: open a QUIC connection, open the control stream, send a signed CONNECT built from identity, and wait for a HELLO whose own signature verifies against the node_id it claims.

identity must be puzzle-hardened (KeyPair::generate_with_puzzle) — see that function’s own doc and plans/PLAN_WIRE_PROTOCOL.md §5’s callout: an unhardened identity fails this handshake silently (the QUIC/TLS layer looks healthy right up until the HELLO never accepts).