Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Crypto ¶
type Crypto struct {
// contains filtered or unexported fields
}
Crypto is a struct for encrypting and decrypting data using AES CBC mode.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher is to dispatch the response to the corresponding channel.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(sn uint32, body []byte) error
Dispatch dispatches the response to the corresponding channel.
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(sn uint32, ch *ProtobufChan)
Register registers a channel with a serial number.
type DispatcherHub ¶
type DispatcherHub struct {
// contains filtered or unexported fields
}
DispatcherHub is to store dispatchers for different proto id, key is proto id.
func NewDispatcherHub ¶
func NewDispatcherHub() *DispatcherHub
NewDispatcherHub creates a new dispatcher hub.
func (*DispatcherHub) Dispatch ¶
func (h *DispatcherHub) Dispatch(id uint32, sn uint32, body []byte) error
Dispatch dispatches the response to the corresponding channel.
func (*DispatcherHub) Register ¶
func (h *DispatcherHub) Register(id uint32, sn uint32, ch *ProtobufChan)
Register registers a dispatcher with a proto id and serial number.
type ProtobufChan ¶
type ProtobufChan struct {
// contains filtered or unexported fields
}
ProtobufChan is a wrapper for chan *T, T is a struct and *T implements proto.Message.
func NewProtobufChan ¶
func NewProtobufChan(i any) *ProtobufChan
NewProtobufChan creates a new ProtobufChan.
func (*ProtobufChan) Send ¶
func (ch *ProtobufChan) Send(b []byte) error
Send unmarshals b into a proto message and send it to the channel.