Documentation
¶
Overview ¶
Package wire defines P2P message types for network communication. This package is wire-format agnostic - encoding is handled by the parent message package.
Index ¶
- Variables
- func Marshal(m *Message) ([]byte, error)
- type Accepted
- type AcceptedFrontier
- type AcceptedStateSummary
- type Ancestors
- type BFT
- type BloomFilter
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Reset()
- func (b *Buffer) WriteBytes(data []byte)
- func (b *Buffer) WriteBytesSlice(slices [][]byte)
- func (b *Buffer) WriteString(s string)
- func (b *Buffer) WriteUint16(v uint16)
- func (b *Buffer) WriteUint32(v uint32)
- func (b *Buffer) WriteUint32Slice(vals []uint32)
- func (b *Buffer) WriteUint64(v uint64)
- func (b *Buffer) WriteUint64Slice(vals []uint64)
- func (b *Buffer) WriteUint8(v uint8)
- type ChainSubnetPair
- type Chits
- type ClaimedIpPort
- type Client
- type EngineType
- type Get
- type GetAccepted
- type GetAcceptedFrontier
- type GetAcceptedStateSummary
- type GetAncestors
- type GetPeerList
- type GetStateSummaryFrontier
- type Gossip
- type Handshake
- type Message
- type PeerList
- type Ping
- type Pong
- type PullQuery
- type PushQuery
- type Put
- type Reader
- func (r *Reader) ReadBytes() ([]byte, error)
- func (r *Reader) ReadBytesSlice() ([][]byte, error)
- func (r *Reader) ReadString() (string, error)
- func (r *Reader) ReadUint16() (uint16, error)
- func (r *Reader) ReadUint32() (uint32, error)
- func (r *Reader) ReadUint32Slice() ([]uint32, error)
- func (r *Reader) ReadUint64() (uint64, error)
- func (r *Reader) ReadUint64Slice() ([]uint64, error)
- func (r *Reader) ReadUint8() (uint8, error)
- type Request
- type Response
- type StateSummaryFrontier
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidMessage = errors.New("invalid wire message") ErrUnknownTag = errors.New("unknown message tag") )
Functions ¶
Types ¶
type AcceptedFrontier ¶
AcceptedFrontier message
func (*AcceptedFrontier) GetChainId ¶
func (m *AcceptedFrontier) GetChainId() []byte
func (*AcceptedFrontier) GetRequestId ¶
func (m *AcceptedFrontier) GetRequestId() uint32
type AcceptedStateSummary ¶
AcceptedStateSummary message
func (*AcceptedStateSummary) GetChainId ¶
func (m *AcceptedStateSummary) GetChainId() []byte
func (*AcceptedStateSummary) GetRequestId ¶
func (m *AcceptedStateSummary) GetRequestId() uint32
type BloomFilter ¶
BloomFilter for peer discovery
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer for zero-copy encoding
func (*Buffer) WriteBytes ¶
func (*Buffer) WriteBytesSlice ¶
func (*Buffer) WriteString ¶
func (*Buffer) WriteUint16 ¶
func (*Buffer) WriteUint32 ¶
func (*Buffer) WriteUint32Slice ¶
func (*Buffer) WriteUint64 ¶
func (*Buffer) WriteUint64Slice ¶
func (*Buffer) WriteUint8 ¶
type ChainSubnetPair ¶
ChainSubnetPair for ping
type Chits ¶
type Chits struct {
ChainId []byte
RequestId uint32
PreferredId []byte
PreferredIdAtHeight []byte
AcceptedId []byte
}
Chits message
func (*Chits) GetChainId ¶
func (*Chits) GetRequestId ¶
type ClaimedIpPort ¶
type ClaimedIpPort struct {
X509Certificate []byte
IpAddr []byte
IpPort uint32
Timestamp uint64
Signature []byte
TxId []byte
}
ClaimedIpPort in peer list
type EngineType ¶
type EngineType int32
EngineType represents the consensus engine type
const ( EngineType_UNSPECIFIED EngineType = 0 EngineType_CHAIN EngineType = 1 EngineType_DAG EngineType = 2 )
type Get ¶
type Get struct {
ChainId []byte
RequestId uint32
Deadline uint64
ContainerId []byte
EngineType EngineType
}
Get message
func (*Get) GetChainId ¶
func (*Get) GetDeadline ¶
func (*Get) GetRequestId ¶
type GetAccepted ¶
type GetAccepted struct {
ChainId []byte
RequestId uint32
Deadline uint64
ContainerIds [][]byte
EngineType EngineType
}
GetAccepted message
func (*GetAccepted) GetChainId ¶
func (m *GetAccepted) GetChainId() []byte
func (*GetAccepted) GetDeadline ¶
func (m *GetAccepted) GetDeadline() uint64
func (*GetAccepted) GetRequestId ¶
func (m *GetAccepted) GetRequestId() uint32
type GetAcceptedFrontier ¶
type GetAcceptedFrontier struct {
ChainId []byte
RequestId uint32
Deadline uint64
EngineType EngineType
}
GetAcceptedFrontier message
func (*GetAcceptedFrontier) GetChainId ¶
func (m *GetAcceptedFrontier) GetChainId() []byte
func (*GetAcceptedFrontier) GetDeadline ¶
func (m *GetAcceptedFrontier) GetDeadline() uint64
func (*GetAcceptedFrontier) GetRequestId ¶
func (m *GetAcceptedFrontier) GetRequestId() uint32
type GetAcceptedStateSummary ¶
type GetAcceptedStateSummary struct {
ChainId []byte
RequestId uint32
Deadline uint64
Heights []uint64
}
GetAcceptedStateSummary message
func (*GetAcceptedStateSummary) GetChainId ¶
func (m *GetAcceptedStateSummary) GetChainId() []byte
func (*GetAcceptedStateSummary) GetDeadline ¶
func (m *GetAcceptedStateSummary) GetDeadline() uint64
func (*GetAcceptedStateSummary) GetRequestId ¶
func (m *GetAcceptedStateSummary) GetRequestId() uint32
type GetAncestors ¶
type GetAncestors struct {
ChainId []byte
RequestId uint32
Deadline uint64
ContainerId []byte
EngineType EngineType
}
GetAncestors message
func (*GetAncestors) GetChainId ¶
func (m *GetAncestors) GetChainId() []byte
func (*GetAncestors) GetDeadline ¶
func (m *GetAncestors) GetDeadline() uint64
func (*GetAncestors) GetEngineType ¶
func (m *GetAncestors) GetEngineType() EngineType
func (*GetAncestors) GetRequestId ¶
func (m *GetAncestors) GetRequestId() uint32
type GetStateSummaryFrontier ¶
GetStateSummaryFrontier message
func (*GetStateSummaryFrontier) GetChainId ¶
func (m *GetStateSummaryFrontier) GetChainId() []byte
func (*GetStateSummaryFrontier) GetDeadline ¶
func (m *GetStateSummaryFrontier) GetDeadline() uint64
func (*GetStateSummaryFrontier) GetRequestId ¶
func (m *GetStateSummaryFrontier) GetRequestId() uint32
type Handshake ¶
type Handshake struct {
NetworkId uint32
MyTime uint64
IpAddr []byte
IpPort uint32
IpSigningTime uint64
IpNodeIdSig []byte
TrackedSubnets [][]byte
Client *Client
SupportedAcps []uint32
ObjectedAcps []uint32
KnownPeers *BloomFilter
IpBlsSig []byte
}
Handshake message
type Message ¶
type Message struct {
// Only one of these should be set
CompressedZstd []byte
Ping *Ping
Pong *Pong
Handshake *Handshake
GetPeerList *GetPeerList
PeerList *PeerList
GetStateSummaryFrontier *GetStateSummaryFrontier
StateSummaryFrontier *StateSummaryFrontier
GetAcceptedStateSummary *GetAcceptedStateSummary
AcceptedStateSummary *AcceptedStateSummary
GetAcceptedFrontier *GetAcceptedFrontier
AcceptedFrontier *AcceptedFrontier
GetAccepted *GetAccepted
Accepted *Accepted
GetAncestors *GetAncestors
Ancestors *Ancestors
Get *Get
Put *Put
PushQuery *PushQuery
PullQuery *PullQuery
Chits *Chits
Request *Request
Response *Response
Gossip *Gossip
BFT *BFT
}
Message is the top-level P2P message container
type PullQuery ¶
type PullQuery struct {
ChainId []byte
RequestId uint32
Deadline uint64
ContainerId []byte
EngineType EngineType
RequestedHeight uint64
}
PullQuery message
func (*PullQuery) GetChainId ¶
func (*PullQuery) GetDeadline ¶
func (*PullQuery) GetRequestId ¶
type PushQuery ¶
type PushQuery struct {
ChainId []byte
RequestId uint32
Deadline uint64
Container []byte
EngineType EngineType
RequestedHeight uint64
}
PushQuery message
func (*PushQuery) GetChainId ¶
func (*PushQuery) GetDeadline ¶
func (*PushQuery) GetRequestId ¶
type Put ¶
type Put struct {
ChainId []byte
RequestId uint32
Container []byte
EngineType EngineType
}
Put message
func (*Put) GetChainId ¶
func (*Put) GetRequestId ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader for zero-copy decoding
func (*Reader) ReadBytesSlice ¶
func (*Reader) ReadString ¶
func (*Reader) ReadUint16 ¶
func (*Reader) ReadUint32 ¶
func (*Reader) ReadUint32Slice ¶
func (*Reader) ReadUint64 ¶
func (*Reader) ReadUint64Slice ¶
type Request ¶
Request message (app-level)
func (*Request) GetChainId ¶
func (*Request) GetDeadline ¶
func (*Request) GetRequestId ¶
type Response ¶
Response message (app-level)
func (*Response) GetChainId ¶
func (*Response) GetRequestId ¶
type StateSummaryFrontier ¶
StateSummaryFrontier message
func (*StateSummaryFrontier) GetChainId ¶
func (m *StateSummaryFrontier) GetChainId() []byte
func (*StateSummaryFrontier) GetRequestId ¶
func (m *StateSummaryFrontier) GetRequestId() uint32