-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio_const.go
68 lines (59 loc) · 1.63 KB
/
io_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
package io
import "time"
const (
Ping = "ping"
Pong = "pong"
Register = "register"
B = 1 //1B
KB = 1024 * B //1KB
KB4 = 4 * KB //4KB
MB = 1024 * KB //1MB
GB = 1024 * MB //1GB
TB = 1024 * GB //1TB
PB = 1024 * TB //1PB
EB = 1024 * PB //1EB
DefaultBufferSize = KB4 //默认buff大小,4KB
DefaultChannelSize = 100 //默认通道大小
DefaultPort = 10086 //默认端口
DefaultPortStr = ":10086" //默认端口
DefaultConnectTimeout = time.Second * 2 //默认连接时间
DefaultKeepAlive = time.Minute * 10 //默认保持连接时间
DefaultTimeoutInterval = time.Minute //默认离线检查间隔
DefaultResponseTimeout = time.Second * 10 //默认响应超时时间
)
const (
B_TCP = 0x00 // "TCP"
B_UDP = 0x01 // "UDP"
B_HTTP = 0x02 // "HTTP"
B_Websocket = 0x03 // "Websocket"
B_Memory = 0x04 // "Memory"
B_Serial = 0x05 // "Serial"
B_SSH = 0x06 // "SSH"
B_MQTT = 0x07 // "MQTT"
)
const (
TCP = "tcp"
UDP = "udp"
HTTP = "http"
Websocket = "websocket"
Memory = "memory"
Serial = "serial"
SSH = "ssh"
MQTT = "mqtt"
)
const (
OprPing = 0x00 // "ping" 心跳
OprRead = 0x01 // "read" 读取数据
OprWrite = 0x02 // "write" 写入数据
OprSubscribe = 0x03 // "subscribe" 订阅数据
OprConnect = 0x04 // "connect" 建立连接
OprClose = 0x05 // "close" 关闭连接
)
const (
FliedKey = "key"
FliedCode = "code"
FliedData = "data"
FliedMsg = "msg"
FliedAddress = "address"
FliedError = "error"
)