-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconst.go
72 lines (63 loc) · 1.62 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
package passtor
import (
"fmt"
"math"
"os"
"time"
)
const (
// DHTK K parameter for DHT K-buckets
DHTK = 5
// ALPHA DHT concurrency parameter
ALPHA = 2
// REPL replication factor
REPL = 3
// NREQ minimal number of response after Fetch
NREQ = 2
// THRESHOLD of answers before returning
THRESHOLD = 0.333
// TIMEOUT value when waiting for an answer
TIMEOUT = 1 * time.Second
// MINRETRIES min number of attemps before giving up reaching an host
MINRETRIES = 1
// MAXRETRIES max number of attemps before giving up reaching an host
MAXRETRIES = 4
// BUFFERSIZE size of the udp connection read buffer
BUFFERSIZE = 8192
// BYTELENGTH number of bits in a byte
BYTELENGTH uint16 = 8
// PASSPHRASELENGHT default length in words for a passphrase
PASSPHRASELENGHT = 8
// PASSPHRASESEP default word seperator in a passphrase
PASSPHRASESEP = "."
// V0 verbose level 0 (no output)
V0 = 0
// V1 verbose level 1 (normal output)
V1 = 1
// V2 verbose level 2 (mode verbose)
V2 = 2
// V3 verbose level 3 (mode verbose++)
V3 = 3
// TCPMAXPACKETSIZE is the largest size in bytes of a TCP packet
TCPMAXPACKETSIZE = 65535
// REPUBLISHINTERVAL average time interval between republish in minutes
REPUBLISHINTERVAL = 5
)
// Errors
// NOERROR string
var NOERROR = ""
// ALREADYSTORED error string
var ALREADYSTORED = "Account already stored and up-to-date"
// MAXDISTANCE maximum distance between two hashes
var MAXDISTANCE Hash
func init() {
// set MAXDISTANCE
b := byte(math.MaxUint8)
for i := range MAXDISTANCE {
MAXDISTANCE[i] = b
}
if REPL > DHTK {
fmt.Println("Replication factor can't be larger than K")
os.Exit(1)
}
}