add new feature
This commit is contained in:
@@ -10,19 +10,33 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"b612.me/starainrt"
|
||||
"b612.me/starcrypto"
|
||||
|
||||
"b612.me/starnet"
|
||||
)
|
||||
|
||||
var builder *starainrt.StarQueue
|
||||
var builder *starnet.StarQueue
|
||||
var aesKey = []byte{0x19, 0x96, 0x11, 0x27, 228, 187, 187, 231, 142, 137, 230, 179, 189, 229, 184, 133}
|
||||
|
||||
func encodeFunc(data []byte) []byte {
|
||||
return starcrypto.AesEncryptCFB(data, aesKey)
|
||||
}
|
||||
|
||||
func decodeFunc(data []byte) []byte {
|
||||
return starcrypto.AesDecryptCFB(data, aesKey)
|
||||
}
|
||||
|
||||
func init() {
|
||||
builder = starainrt.NewQueue()
|
||||
builder = starnet.NewQueue()
|
||||
builder.EncodeFunc = encodeFunc
|
||||
builder.DecodeFunc = decodeFunc
|
||||
builder.Encode = true
|
||||
}
|
||||
|
||||
// StarNotifyS 为Server端
|
||||
type StarNotifyS struct {
|
||||
// Queue 是用来处理收发信息的简单消息队列
|
||||
Queue *starainrt.StarQueue
|
||||
Queue *starnet.StarQueue
|
||||
// FuncLists 记录了被通知项所记录的函数
|
||||
FuncLists map[string]func(SMsg) string
|
||||
defaultFunc func(SMsg) string
|
||||
@@ -199,7 +213,10 @@ func (star *StarNotifyS) SendWait(source SMsg, key, value string, tmout time.Dur
|
||||
|
||||
func (star *StarNotifyS) starinits() {
|
||||
star.stopSign, star.cancel = context.WithCancel(context.Background())
|
||||
star.Queue = starainrt.NewQueue()
|
||||
star.Queue = starnet.NewQueue()
|
||||
star.Queue.EncodeFunc = encodeFunc
|
||||
star.Queue.DecodeFunc = decodeFunc
|
||||
star.Queue.Encode = true
|
||||
star.udpPool = make(map[string]*net.UDPAddr)
|
||||
star.FuncLists = make(map[string]func(SMsg) string)
|
||||
star.connPool = make(map[string]net.Conn)
|
||||
|
||||
Reference in New Issue
Block a user