-
Notifications
You must be signed in to change notification settings - Fork 459
/
const.go
104 lines (81 loc) · 3.46 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright (c) nano Author and TFG Co. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package constants
const (
_ int32 = iota
// StatusStart status
StatusStart
// StatusHandshake status
StatusHandshake
// StatusWorking status
StatusWorking
// StatusClosed status
StatusClosed
)
const (
// SessionPushRoute is the route used for updating session
SessionPushRoute = "sys.pushsession"
// SessionBindRoute is the route used for binding session
SessionBindRoute = "sys.bindsession"
// KickRoute is the route used for kicking an user
KickRoute = "sys.kick"
)
// SessionCtxKey is the context key where the session will be set
var SessionCtxKey = "session"
// LoggerCtxKey is the context key where the default logger will be set
var LoggerCtxKey = "default-logger"
type propagateKey struct{}
// PropagateCtxKey is the context key where the content that will be
// propagated through rpc calls is set
var PropagateCtxKey = propagateKey{}
// SpanPropagateCtxKey is the key holding the opentracing spans inside
// the propagate key
var SpanPropagateCtxKey = "opentracing-span"
// PeerIDKey is the key holding the peer id to be sent over the context
var PeerIDKey = "peer.id"
// PeerServiceKey is the key holding the peer service to be sent over the context
var PeerServiceKey = "peer.service"
// StartTimeKey is the key holding the request start time (in ns) to be sent over the context
var StartTimeKey = "req-start-time"
// RequestIDKey is the key holding the request id to be sent over the context
var RequestIDKey = "request.id"
// RouteKey is the key holding the request route to be sent over the context
var RouteKey = "req-route"
// MetricTagsKey is the key holding request tags to be sent over the context
// to be reported
var MetricTagsKey = "metric-tags"
// GRPCHostKey is the key for grpc host on server metadata
var GRPCHostKey = "grpcHost"
// GRPCExternalHostKey is the key for grpc external host on server metadata
var GRPCExternalHostKey = "grpc-external-host"
// GRPCPortKey is the key for grpc port on server metadata
var GRPCPortKey = "grpcPort"
// GRPCExternalPortKey is the key for grpc external port on server metadata
var GRPCExternalPortKey = "grpc-external-port"
// RegionKey is the key to save the region server is on
var RegionKey = "region"
// IP constants
const (
IPVersionKey = "ipversion"
IPv4 = "ipv4"
IPv6 = "ipv6"
)
// IOBufferBytesSize will be used when reading messages from clients
var IOBufferBytesSize = 4096