package
0.0.0-20170807230502-babd247ae214
Repository: https://github.com/livepeer/go-ppspp.git
Documentation: pkg.go.dev
# Functions
NewLibp2pPeer makes a new peer with a libp2p network.
NewPeer makes a new peer.
NewPpspp creates a new PPSPP protocol object.
NewPpsppPeer makes a new peer with a ppspp protocol.
NewStubNetwork creates a new StubNetwork.
NewSwarm creates a new Swarm.
WrapStream takes a stream and complements it with r/w bufios and decoder/encoder.
# Constants
Begin is the initial state before a handshake.
From the RFC: +----------+------------------+ | Msg Type | Description | +----------+------------------+ | 0 | HANDSHAKE | | 1 | DATA | | 2 | ACK | | 3 | HAVE | | 4 | INTEGRITY | | 5 | PEX_RESv4 | | 6 | PEX_REQ | | 7 | SIGNED_INTEGRITY | | 8 | REQUEST | | 9 | CANCEL | | 10 | CHOKE | | 11 | UNCHOKE | | 12 | PEX_RESv6 | | 13 | PEX_REScert | | 14-254 | Unassigned | | 255 | Reserved | +----------+------------------+.
From the RFC: +----------+------------------+ | Msg Type | Description | +----------+------------------+ | 0 | HANDSHAKE | | 1 | DATA | | 2 | ACK | | 3 | HAVE | | 4 | INTEGRITY | | 5 | PEX_RESv4 | | 6 | PEX_REQ | | 7 | SIGNED_INTEGRITY | | 8 | REQUEST | | 9 | CANCEL | | 10 | CHOKE | | 11 | UNCHOKE | | 12 | PEX_RESv6 | | 13 | PEX_REScert | | 14-254 | Unassigned | | 255 | Reserved | +----------+------------------+.
From the RFC: +----------+------------------+ | Msg Type | Description | +----------+------------------+ | 0 | HANDSHAKE | | 1 | DATA | | 2 | ACK | | 3 | HAVE | | 4 | INTEGRITY | | 5 | PEX_RESv4 | | 6 | PEX_REQ | | 7 | SIGNED_INTEGRITY | | 8 | REQUEST | | 9 | CANCEL | | 10 | CHOKE | | 11 | UNCHOKE | | 12 | PEX_RESv6 | | 13 | PEX_REScert | | 14-254 | Unassigned | | 255 | Reserved | +----------+------------------+.
Ready means the handshake is complete and the peer is ready for other types of messages.
From the RFC: +----------+------------------+ | Msg Type | Description | +----------+------------------+ | 0 | HANDSHAKE | | 1 | DATA | | 2 | ACK | | 3 | HAVE | | 4 | INTEGRITY | | 5 | PEX_RESv4 | | 6 | PEX_REQ | | 7 | SIGNED_INTEGRITY | | 8 | REQUEST | | 9 | CANCEL | | 10 | CHOKE | | 11 | UNCHOKE | | 12 | PEX_RESv6 | | 13 | PEX_REScert | | 14-254 | Unassigned | | 255 | Reserved | +----------+------------------+.
Unknown state is used for errors.
WaitHandshake means waiting for ack of the first handshake.
# Structs
Chan holds the current state of a channel.
Chunk represents a PPSPP chunk of content.
Datagram holds a protocol datagram.
DataMsg holds a data message data payload.
HandshakeMsg holds a handshake message data payload.
HaveMsg holds a have message data payload.
Msg holds a protocol message.
MsgError is an error that happens while handling an incoming message.
Peer implements protocol logic and underlying network.
Ppspp is a PPSPP implementation.
RequestMsg holds a have message data payload.
StringPeerID is a simple implementation of PeerID using an underlying string Used for stubs.
StubNetwork stores all sent datagrams without sending them anywhere.
StubProtocol handles incoming datagrams by storing them.
Swarm tracks info related to a swarm.
SwarmConfig is used to create a Swarm.
SwarmMetadata stores the metadata of a Swarm See: https://tools.ietf.org/html/rfc7574#section-3.1.
WrappedStream wraps a libp2p stream.
# Type aliases
ChanID identifies a channel.
ChunkID identifies a chunk of content.
Opcode identifies the type of message.
ProtocolState is a per-channel state local to a peer.
SwarmDataHandler is a function that's invoked with new data chunks that have just been received.
SwarmID identifies a swarm.