Skip to main content

pair_dial

Function pair_dial 

Source
pub fn pair_dial<S: Read + Write + ReadTimeout + WriteTimeout>(
    stream: S,
    identity: &Identity,
    pairing: Pairing,
    responder: &ResponderTrust,
    config: &PairConfig,
) -> Result<PairDial<S>, PeerError>
Expand description

Dials a pairing connection over stream as identity and runs pairing until there is something to show, or to its end; PairDial::finish completes it.

The connection uses config’s policy and ALPN and is bound to the exchange by its exporter. An invitation pins the inviter; a PIN pairing may leave the responder Unverified because the PIN authenticates it; the device flow needs a Verified responder unless the pairing allows otherwise. The handshake, this call and PairDial::finish together wait at most PairConfig::timeout.

§Errors

PeerError::Pairing; PeerError::Io when the handshake or connection fails or the timeout passes (a pinned inviter that is someone else is refused here, with PeerError::refusal); PeerError::Tls when the server did not negotiate the pairing ALPN.