| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
LibP2P.Transport
Description
Transport abstraction for libp2p.
Defines the record-of-functions pattern for transport-agnostic connection management. Stream transports produce a byte stream for the standard security/muxer upgrade; native multiplexed transports such as QUIC provide an already authenticated stream multiplexer.
Synopsis
- data ConnectionEndpoint
- data NativeMuxer = NativeMuxer {
- nativePeerId :: !PeerId
- nativeSecurity :: !ProtocolId
- nativeMuxerProtocol :: !ProtocolId
- nativeOpenStream :: !(IO StreamIO)
- nativeAcceptStream :: !(IO StreamIO)
- nativeClose :: !(IO ())
- data RelayCircuitLimit = RelayCircuitLimit {
- rclDurationSeconds :: !(Maybe Word32)
- rclDataBytes :: !(Maybe Word64)
- relayCircuitIsLimited :: Maybe RelayCircuitLimit -> Bool
- data RawConnection = RawConnection {
- rcEndpoint :: !ConnectionEndpoint
- rcLocalAddr :: !Multiaddr
- rcRemoteAddr :: !Multiaddr
- rcClose :: !(IO ())
- rcRelayLimit :: !(Maybe RelayCircuitLimit)
- data Listener = Listener {
- listenerAccept :: !(IO RawConnection)
- listenerClose :: !(IO ())
- listenerAddr :: !Multiaddr
- data Transport = Transport {
- transportDial :: !(Multiaddr -> IO RawConnection)
- transportDialFrom :: !(Maybe Multiaddr -> Multiaddr -> IO RawConnection)
- transportListen :: !(Multiaddr -> IO Listener)
- transportCanDial :: !(Multiaddr -> Bool)
Documentation
data ConnectionEndpoint Source #
The I/O endpoint established by a transport.
Constructors
| ByteStreamEndpoint !StreamIO | |
| NativeMuxerEndpoint !NativeMuxer |
data NativeMuxer Source #
A transport-native authenticated stream multiplexer.
Constructors
| NativeMuxer | |
Fields
| |
data RelayCircuitLimit Source #
Budget a relay advertised for one relayed circuit (specsrelaycircuit-v2).
A component of 0, or an absent component, means that component is
unlimited. Nothing on a connection means it is not a relay circuit.
Constructors
| RelayCircuitLimit | |
Fields
| |
Instances
| Show RelayCircuitLimit Source # | |
Defined in LibP2P.Transport Methods showsPrec :: Int -> RelayCircuitLimit -> ShowS # show :: RelayCircuitLimit -> String # showList :: [RelayCircuitLimit] -> ShowS # | |
| Eq RelayCircuitLimit Source # | |
Defined in LibP2P.Transport Methods (==) :: RelayCircuitLimit -> RelayCircuitLimit -> Bool # (/=) :: RelayCircuitLimit -> RelayCircuitLimit -> Bool # | |
relayCircuitIsLimited :: Maybe RelayCircuitLimit -> Bool Source #
True when the relay imposed a non-zero duration or a non-zero per-direction data cap. A zero or omitted component does not count.
data RawConnection Source #
A connection established by a transport.
TCP and relayed connections carry an unencrypted byte stream. QUIC carries a TLS-authenticated native multiplexer and therefore bypasses Noise/Yamux.
Constructors
| RawConnection | |
Fields
| |
A listener that accepts inbound connections.
Constructors
| Listener | |
Fields
| |
Transport provides dial/listen capabilities for a specific protocol.
Constructors
| Transport | |
Fields
| |