Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct {
PacketIndex int // 包序
Fn func() (ok bool) `json:"-"` // 业务回调代码
ReqUrl string // 请求地址
Info string // 功能描述,包信息或预期获取内容
}
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │Api │Function │Note │Todo │Chinese ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │netPacket_container │ │ │ │ ├───RegisterPacketHandles(handles []Handle) │Register Packet Handles as work pool │ │ │方是的是的是否电风扇所发生的 ├───SetHandles(handles []Handle) │RegisterPacketHandles means │ │ │ ├───Handles() []Handle │work pool │work center │ │ ├───HandlePacket() (ok bool) │rang work pool packet and post them │ │ │ ├───SetEvent(event any) │set a event for any work │ │ │ ├───SetEventsCap(cap int) │Set Events Cap │ │ │ ├───Events() <-chan any │pop events │ │ │ ├───HandleEvent() │rang event and handle them │need handle by your self │ │ ├───HttpClient() httpClient.Interface │http client │ │add udp wss etc │ ├─── │ │ │ │ └─── │ │ │add Worn echo and saveDataBase api │
type Interface ¶
type Interface interface {
RegisterPacketHandles(handles []Handle) // 注册或设置业务集
// SetHandles(handles []Handle)
Handles() []Handle // 业务集
HandlePacket() (ok bool) // 遍历业务集并发出每个业务包请求
SetEvent(event any) // 接受任意类型的消息事件
SetEventsCap(cap int) // 设置消息事件数量
Events() <-chan any // 信道先进先出队列存储事件信号
HandleEvent() // todo 多态业务只要分态处理事件即可,即:这里处理如何退出主程序,或者永远不要退出,其余的接口签名通通 panic("implement me") 即可
HttpClient() *httpClient.Object // http客户端接口(转发,cookie,表单,容错,各种请求方式等的封装),todo add udp,wss
}
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │Api │Function │Note │Todo │Chinese ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │netPacket_container │ │ │ │ ├───RegisterPacketHandles(handles []Handle) │Register Packet Handles as work pool │ │ │方是的是的是否电风扇所发生的 ├───SetHandles(handles []Handle) │RegisterPacketHandles means │ │ │ ├───Handles() []Handle │work pool │work center │ │ ├───HandlePacket() (ok bool) │rang work pool packet and post them │ │ │ ├───SetEvent(event any) │set a event for any work │ │ │ ├───SetEventsCap(cap int) │Set Events Cap │ │ │ ├───Events() <-chan any │pop events │ │ │ ├───HandleEvent() │rang event and handle them │need handle by your self │ │ ├───HttpClient() httpClient.Interface │http client │ │add udp wss etc │ ├─── │ │ │ │ └─── │ │ │add Worn echo and saveDataBase api │