Documentation
¶
Overview ¶
Package msg pkg/cxo/node/msg/msg.go c2-net-cxo
Index ¶
Constants ¶
const ( PingType = 1 + iota // 1 PongType // 2 SynType // 3 AckType // 4 OkType // 5 ErrType // 6 SubType // 7 UnsubType // 8 RqListType // 9 ListType // 10 RootType // 11 RqObjectType // 12 ObjectType // 13 RqPreviewType // 14 RqPeersType // 15 PeersType // 16 RqDeltaType // 17 ObjectsType // 18 )
Types
const DeltaProbeReply = "rqdelta/1"
DeltaProbeReply is the Err text that answers DeltaProbe.
const Version uint16 = 3
Version is current protocol version
Variables ¶
var ( // ErrEmptyMessage occurs when you // try to Decode an empty slice ErrEmptyMessage = errors.New("empty message") // ErrIncomplieDecoding occurs when incoming message // decoded correctly but the decoding doesn't use // entire encoded message ErrIncomplieDecoding = errors.New("incomplete decoding") )
var DeltaProbe = cipher.SumSHA256([]byte("cxo/rqdelta/1"))
DeltaProbe is the key of an RqObject that asks whether the peer serves RqDelta. A peer that does answers Err{DeltaProbeReply}. An older one answers an empty Err, and closes the connection on an RqDelta, which it cannot decode. Version stays the same so both still connect.
Functions ¶
This section is empty.
Types ¶
type Ack ¶
An Ack is response for the Syn if handshake has been accepted. Otherwise, the Err returned
type InvalidTypeError ¶
type InvalidTypeError struct {
// contains filtered or unexported fields
}
An InvalidTypeError represents decoding error when incoming message is malformed and its type invalid
func (InvalidTypeError) Error ¶
func (e InvalidTypeError) Error() string
Error implements builting error interface
func (InvalidTypeError) Type ¶
func (e InvalidTypeError) Type() Type
Type return Type which cause the error
type Msg ¶
type Msg interface {
Type() Type // type of the message to encode
Encode() []byte // encode the message to []byte prefixed with the Type
}
A Msg is common interface for CXO messages
type Object ¶
type Object struct {
Value []byte // encoded object in person
}
An Object reperesents encoded object
type Objects ¶
type Objects struct {
Values [][]byte
}
Objects is the reply to RqDelta. The receiver checks every value by its hash, so it trusts nothing it did not ask for.
type Root ¶
type Root struct {
Feed cipher.PubKey // feed }
Nonce uint64 // head } Root selector
Seq uint64 // seq }
Value []byte // encoded Root in person
Sig cipher.Sig // signature
}
A Root sent from one node to another one to update root object of feed described in Feed field of the message
type RqDelta ¶
RqDelta asks for the objects new in the Roots Since..Seq of a head, the ones the peer saved or fetched for them, so a fill needs one round trip instead of one per object.