Documentation
¶
Index ¶
Constants ¶
View Source
const ( AGENCY_NONE uint = 0 AGENCY_CLIENT uint = 1 AGENCY_SERVER uint = 2 )
View Source
const (
// This is completely arbitrary, but the line had to be drawn somewhere
MAX_MESSAGES_PER_SEGMENT = 20
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageBase ¶
type MessageBase struct { MessageType uint8 // contains filtered or unexported fields }
func (*MessageBase) Cbor ¶
func (m *MessageBase) Cbor() []byte
func (*MessageBase) SetCbor ¶
func (m *MessageBase) SetCbor(data []byte)
func (*MessageBase) Type ¶
func (m *MessageBase) Type() uint8
type MessageHandlerFunc ¶
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
func New ¶
func New(config ProtocolConfig) *Protocol
func (*Protocol) Mode ¶ added in v0.9.0
func (p *Protocol) Mode() ProtocolMode
func (*Protocol) Role ¶ added in v0.9.0
func (p *Protocol) Role() ProtocolRole
func (*Protocol) SendMessage ¶
type ProtocolConfig ¶ added in v0.8.0
type ProtocolConfig struct { Name string ProtocolId uint16 ErrorChan chan error Muxer *muxer.Muxer Mode ProtocolMode Role ProtocolRole MessageHandlerFunc MessageHandlerFunc MessageFromCborFunc MessageFromCborFunc StateMap StateMap InitialState State }
type ProtocolMode ¶ added in v0.9.0
type ProtocolMode uint
const ( ProtocolModeNone ProtocolMode = 0 ProtocolModeNodeToClient ProtocolMode = 1 ProtocolModeNodeToNode ProtocolMode = 2 )
type ProtocolOptions ¶ added in v0.9.0
type ProtocolOptions struct { Muxer *muxer.Muxer ErrorChan chan error Mode ProtocolMode Role ProtocolRole Version uint16 }
Common arguments for individual mini-protocols
type ProtocolRole ¶ added in v0.9.0
type ProtocolRole uint
const ( ProtocolRoleNone ProtocolRole = 0 ProtocolRoleClient ProtocolRole = 1 ProtocolRoleServer ProtocolRole = 2 )
type StateMap ¶ added in v0.8.0
type StateMap map[State]StateMapEntry
type StateMapEntry ¶ added in v0.8.0
type StateMapEntry struct { Agency uint Transitions []StateTransition }
type StateTransition ¶ added in v0.8.0
type StateTransition struct { MsgType uint8 NewState State MatchFunc StateTransitionMatchFunc }
type StateTransitionMatchFunc ¶ added in v0.12.0
Click to show internal directories.
Click to hide internal directories.