-
Notifications
You must be signed in to change notification settings - Fork 15
/
settings.go
77 lines (64 loc) 路 1.7 KB
/
settings.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
package settings
import (
"time"
)
const (
CServiceName = "HLS"
CServiceFullName = "hidden-lake-service"
)
const (
CServiceMask = uint32(0x1750571)
CNetworkMask = uint64(0x676F2D7065657201) // bytes_prefix: go-peer
)
const (
CPathYML = "hls.yml"
CPathDB = "hls.db"
)
const (
CHeaderPublicKey = "Hl-Service-Public-Key"
CHeaderResponseMode = "Hl-Service-Response-Mode"
)
const (
CHeaderResponseModeON = "on" // default
CHeaderResponseModeOFF = "off"
)
const (
CRetryEnqueue = 2
CFetchTimeRatio = 10
)
const (
CDefaultMessageSize = (8 << 10) // 8KiB
CDefaultWorkSize = 22 // bits
CDefaultKeySize = 4096 // bits
CDefaultQueuePeriod = 5000 // 5 seconds
CDefaultQueueRandPeriod = 0 // 0 seconds
CDefaultLimitVoidSize = (4 << 10) // 4KiB
CDefaultF2FDisabled = false // friend-to-friend
CDefaultNetworkKey = "default"
)
const (
CDefaultTCPAddress = "127.0.0.1:9571"
CDefaultHTTPAddress = "127.0.0.1:9572"
)
const (
CQueueMainCapacity = (1 << 8) // 256 messages ~= 2MiB
CQueueVoidCapacity = (1 << 5) // 32 messages ~= 256KiB
)
const (
CNetworkQueueCapacity = (2 << 10) // 2048 hashes ~= 64KiB
CNetworkMaxConns = (1 << 8) // 256 conns
)
const (
CConnKeeperDuration = 10 * time.Second
CConnDialTimeout = 30 * time.Second
CConnWaitReadTimeout = time.Hour
)
const (
CHandleIndexPath = "/api/index"
CHandleConfigSettingsPath = "/api/config/settings"
CHandleConfigConnectsPath = "/api/config/connects"
CHandleConfigFriendsPath = "/api/config/friends"
CHandleNetworkOnlinePath = "/api/network/online"
CHandleNetworkRequestPath = "/api/network/request"
CHandleNetworkPubKeyPath = "/api/network/pubkey"
)