Documentation ¶
Index ¶
- Variables
- func Reply(stream network.Stream, data interface{}) error
- func Send(host core.Host, protocolID protocol.ID, peerID peer.ID, data interface{}) (network.Stream, error)
- func Signature(host core.Host, message *Message) ([]byte, error)
- func Verify(peerID peer.ID, message *Message) bool
- type ChainPayload
- type ChainType
- type GetChainPayload
- type GetSheetPayload
- type Message
- type MsgHeader
- type MsgType
- type SheetPayload
- type StatusPayload
- type Wired
- func (w *Wired) GetWiredProtocol() protocol.ID
- func (w *Wired) GoServe()
- func (w *Wired) SendGetChain(peerID peer.ID, from [][]byte, to []byte) (id []byte, stream network.Stream, err error)
- func (w *Wired) SendGetSheet(peerID peer.ID, checkpointHeight uint64, checkpointHash []byte) (id []byte, stream network.Stream, err error)
- func (w *Wired) SendPing(peerID peer.ID, origin, latest uint64, ...) (id []byte, stream network.Stream)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMsgMalformed = errors.New("malformed message") ErrMsgIDInvalid = errors.New("message id is invalid") ErrMsgTypeInvalid = errors.New("message type is invalid") ErrMsgSignInvalid = errors.New("message sign is invalid") ErrMsgPayloadInvalid = errors.New("message payload is invalid") )
Functions ¶
func Send ¶
func Send(host core.Host, protocolID protocol.ID, peerID peer.ID, data interface{}) (network.Stream, error)
Send is a helper method - writes a protobuf go data object to a network stream. then the stream will be returned and caller is able to read the response from it.
Types ¶
type ChainPayload ¶
type ChainPayload struct { Type ChainType Headers []*ngtypes.BlockHeader `rlp:"optional"` Blocks []*ngtypes.Block `rlp:"optional"` }
func DecodeChainPayload ¶
func DecodeChainPayload(rawPayload []byte) (*ChainPayload, error)
DecodeChainPayload unmarshal the raw and return the *pb.ChainPayload.
type GetChainPayload ¶
type GetSheetPayload ¶
GetSheetPayload is the payload for getting a sheet from remote Design: fast-sync for state support checkpoint height only when fast-sync:
- sync to latest checkpoint
- sync to latest checkpoint state
- sync the remaining blocks
- update local state
type MsgHeader ¶
type SheetPayload ¶
func DecodeSheetPayload ¶
func DecodeSheetPayload(rawPayload []byte) (*SheetPayload, error)
DecodeSheetPayload unmarshal the raw and return the *message.PongPayload.
type StatusPayload ¶
type StatusPayload struct { Origin uint64 Latest uint64 CheckpointHash []byte CheckpointDiff []byte // actual diff }
StatusPayload is the payload used when ping pong.
func DecodePongPayload ¶
func DecodePongPayload(rawPayload []byte) (*StatusPayload, error)
DecodePongPayload unmarshal the raw and return the *message.PongPayload.
type Wired ¶
type Wired struct {
// contains filtered or unexported fields
}
Wired type.
func NewWiredProtocol ¶
func (*Wired) GetWiredProtocol ¶
func (*Wired) SendGetChain ¶
func (*Wired) SendGetSheet ¶
Click to show internal directories.
Click to hide internal directories.