代码规范过滤,移除冗余代码,替换掉不推荐的包

This commit is contained in:
孟帅
2023-05-30 12:09:40 +08:00
parent c8a808fcfd
commit b2ef3487d3
74 changed files with 564 additions and 741 deletions

View File

@@ -7,7 +7,6 @@ package tcp
import (
"context"
"github.com/gogf/gf/v2/net/gtcp"
"github.com/gogf/gf/v2/net/gtrace"
"hotgo/internal/consts"
)
@@ -24,11 +23,6 @@ func initCtx(ctx context.Context, model *Context) (newCtx context.Context, cance
return
}
// SetCtx 设置上下文变量
func SetCtx(ctx context.Context, model *Context) {
context.WithValue(ctx, consts.ContextTCPKey, model)
}
// GetCtx 获得上下文变量如果没有设置那么返回nil
func GetCtx(ctx context.Context) *Context {
value := ctx.Value(consts.ContextTCPKey)
@@ -40,23 +34,3 @@ func GetCtx(ctx context.Context) *Context {
}
return nil
}
// GetCtxConn .
func GetCtxConn(ctx context.Context) *gtcp.Conn {
c := GetCtx(ctx)
if c == nil {
return nil
}
return c.Conn
}
// GetCtxAuth 认证元数据
func GetCtxAuth(ctx context.Context) *AuthMeta {
c := GetCtx(ctx)
if c == nil {
return nil
}
return c.Auth
}