| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Network.LibP2P.NAT.Relay.Client
Contents
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
- makeReservation :: StreamIO -> IO (Either String HopMessage)
- connectViaRelay :: StreamIO -> PeerId -> IO (Either String HopMessage)
- handleStop :: StreamIO -> IO (Either String (PeerId, Maybe RelayLimit))
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.