升级connectionID生成规则
This commit is contained in:
parent
4177c01939
commit
9b9a976663
@ -45,7 +45,7 @@ func NewContext(ginCtx *gin.Context, flag string, session *melody.Session) *WSCo
|
|||||||
d, _ := easymap.NewSegment(128, true)
|
d, _ := easymap.NewSegment(128, true)
|
||||||
l, _ := easylock.NewSegment(128)
|
l, _ := easylock.NewSegment(128)
|
||||||
return &WSContext{
|
return &WSContext{
|
||||||
ConnectionID: generateConnectionID(),
|
ConnectionID: generateConnectionID(flag),
|
||||||
Flag: flag,
|
Flag: flag,
|
||||||
GinCtx: ginCtx,
|
GinCtx: ginCtx,
|
||||||
Session: session,
|
Session: session,
|
||||||
@ -60,8 +60,9 @@ func NewContext(ginCtx *gin.Context, flag string, session *melody.Session) *WSCo
|
|||||||
// Author : go_developer@163.com<张德满>
|
// Author : go_developer@163.com<张德满>
|
||||||
//
|
//
|
||||||
// Date : 5:18 下午 2021/4/8
|
// Date : 5:18 下午 2021/4/8
|
||||||
func generateConnectionID() string {
|
func generateConnectionID(flag string) string {
|
||||||
return fmt.Sprintf("%s-%s-%s",
|
return fmt.Sprintf("%s-%s-%s-%s",
|
||||||
|
flag,
|
||||||
strings.ReplaceAll(util.GetHostIP(), ".", ""),
|
strings.ReplaceAll(util.GetHostIP(), ".", ""),
|
||||||
time.Now().Format("20060102150405"),
|
time.Now().Format("20060102150405"),
|
||||||
util.Md5(fmt.Sprintf("%d", time.Now().UnixNano())+util.GenRandomString("", 64)))
|
util.Md5(fmt.Sprintf("%d", time.Now().UnixNano())+util.GenRandomString("", 64)))
|
||||||
|
Loading…
Reference in New Issue
Block a user