libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.NAT.Relay.Client

Description

Circuit Relay v2 client: make reservations and connect through relays.

Client-side operations: - makeReservation: send RESERVE to relay, receive reservation info - connectViaRelay: send CONNECT to relay, receive relayed stream - handleStop: target receives relay'd connection notification

Synopsis

Client operations

makeReservation :: StreamIO -> IO (Either String HopMessage) Source #

Send a RESERVE request to a relay and receive the reservation response.

connectViaRelay :: StreamIO -> PeerId -> IO (Either String HopMessage) Source #

Send a CONNECT request to a relay to reach a target peer.

Target handler

handleStop :: StreamIO -> IO (Either String (PeerId, Maybe RelayLimit)) Source #

Handle an incoming stop connection from a relay (target side). Reads the CONNECT message, responds with OK, and returns the source peer ID and limit.