Documentation
¶
Overview ¶
Package mux is a generated protocol buffer package.
It is generated from these files:
mux.proto
It has these top-level messages:
PBProtocolMessage
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProtocolID_name = map[int32]string{
0: "Test",
1: "Identify",
2: "Routing",
3: "Exchange",
}
var ProtocolID_value = map[string]int32{
"Test": 0,
"Identify": 1,
"Routing": 2,
"Exchange": 3,
}
Functions ¶
This section is empty.
Types ¶
type Muxer ¶
type Muxer struct { // Protocols are the multiplexed services. Protocols ProtocolMap *msg.Pipe // contains filtered or unexported fields }
Muxer is a simple multiplexor that reads + writes to Incoming and Outgoing channels. It multiplexes various protocols, wrapping and unwrapping data with a ProtocolID.
func NewMuxer ¶
func NewMuxer(mp ProtocolMap) *Muxer
NewMuxer constructs a muxer given a protocol map.
func (*Muxer) AddProtocol ¶
func (m *Muxer) AddProtocol(p Protocol, pid ProtocolID) error
AddProtocol adds a Protocol with given ProtocolID to the Muxer.
type PBProtocolMessage ¶
type PBProtocolMessage struct { ProtocolID *ProtocolID `protobuf:"varint,1,req,enum=mux.ProtocolID" json:"ProtocolID,omitempty"` Data []byte `protobuf:"bytes,2,req" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*PBProtocolMessage) GetData ¶
func (m *PBProtocolMessage) GetData() []byte
func (*PBProtocolMessage) GetProtocolID ¶
func (m *PBProtocolMessage) GetProtocolID() ProtocolID
func (*PBProtocolMessage) ProtoMessage ¶
func (*PBProtocolMessage) ProtoMessage()
func (*PBProtocolMessage) Reset ¶
func (m *PBProtocolMessage) Reset()
func (*PBProtocolMessage) String ¶
func (m *PBProtocolMessage) String() string
type Protocol ¶
Protocol objects produce + consume raw data. They are added to the Muxer with a ProtocolID, which is added to outgoing payloads. Muxer properly encapsulates and decapsulates when interfacing with its Protocols. The Protocols do not encounter their ProtocolID.
type ProtocolID ¶
type ProtocolID int32
const ( ProtocolID_Test ProtocolID = 0 ProtocolID_Identify ProtocolID = 1 ProtocolID_Routing ProtocolID = 2 ProtocolID_Exchange ProtocolID = 3 )
func (ProtocolID) Enum ¶
func (x ProtocolID) Enum() *ProtocolID
func (ProtocolID) String ¶
func (x ProtocolID) String() string
func (*ProtocolID) UnmarshalJSON ¶
func (x *ProtocolID) UnmarshalJSON(data []byte) error
type ProtocolMap ¶
type ProtocolMap map[ProtocolID]Protocol
ProtocolMap maps ProtocolIDs to Protocols.