Skip to main content

accept

Function accept 

Source
pub async fn accept(
    tcp: TcpStream,
    local: LocalPeer<'_>,
    limiter: &HandshakeLimiter,
) -> Result<PeerChannel, PeeringError>
Expand description

Server side of the peering handshake. Admits the source address through limiter (refusing with PeeringError::RateLimited before any TLS byte), completes a real mutual TLS 1.3 handshake over tcp, derives the channel-binding exporter, exchanges hellos (read-then-write, so the pair never deadlocks), and runs the verify_hello check, all within HANDSHAKE_TIMEOUT. Returns the verified channel or the specific rejection — a wrong/revoked/foreign/stale peer fails the whole handshake before any payload, and no channel exists to send one over.