1 Star 0 Fork 2

QunXiongZhuLu / kratos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
key.go 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
王明俊 提交于 2020-12-30 19:23 . ci: add golangci-lint (#675)
package metadata
// metadata common key
const (
// Network
RemoteIP = "remote_ip"
RemotePort = "remote_port"
ServerAddr = "server_addr"
ClientAddr = "client_addr"
// Router
Cluster = "cluster"
Color = "color"
// Trace
Trace = "trace"
Caller = "caller"
// Timeout
Timeout = "timeout"
// Dispatch
CPUUsage = "cpu_usage"
Errors = "errors"
Requests = "requests"
// Mirror
Mirror = "mirror"
// Mid 外网账户用户id
Mid = "mid" // NOTE: !!!业务可重新修改key名!!!
// Device 客户端信息
Device = "device"
// Criticality 重要性
Criticality = "criticality"
)
var outgoingKey = map[string]struct{}{
Color: {},
RemoteIP: {},
RemotePort: {},
Mirror: {},
Criticality: {},
}
var incomingKey = map[string]struct{}{
Caller: {},
}
// IsOutgoingKey represent this key should propagate by rpc.
func IsOutgoingKey(key string) bool {
_, ok := outgoingKey[key]
return ok
}
// IsIncomingKey represent this key should extract from rpc metadata.
func IsIncomingKey(key string) (ok bool) {
_, ok = outgoingKey[key]
if ok {
return
}
_, ok = incomingKey[key]
return
}
1
https://gitee.com/QunXiongZhuLu/kratos.git
git@gitee.com:QunXiongZhuLu/kratos.git
QunXiongZhuLu
kratos
kratos
v0.6.2

搜索帮助