-
Notifications
You must be signed in to change notification settings - Fork 38
/
common.go
45 lines (38 loc) · 1.29 KB
/
common.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
package httpteleport
import (
"github.com/valyala/fastrpc"
)
const protocolVersion = 0
var sniffHeader = "httpteleport"
// CompressType is a compression type used for connections.
type CompressType byte
const (
// CompressNone disables connection compression.
//
// CompressNone may be used in the following cases:
//
// * If network bandwidth between client and server is unlimited.
// * If client and server are located on the same physical host.
// * If other CompressType values consume a lot of CPU resources.
//
CompressNone = CompressType(fastrpc.CompressNone)
// CompressFlate uses compress/flate with default
// compression level for connection compression.
//
// CompressFlate may be used in the following cases:
//
// * If network bandwidth between client and server is limited.
// * If client and server are located on distinct physical hosts.
// * If both client and server have enough CPU resources
// for compression processing.
//
CompressFlate = CompressType(fastrpc.CompressFlate)
// CompressSnappy uses snappy compression.
//
// CompressSnappy vs CompressFlate comparison:
//
// * CompressSnappy consumes less CPU resources.
// * CompressSnappy consumes more network bandwidth.
//
CompressSnappy = CompressType(fastrpc.CompressSnappy)
)