/
peerConfig.go
46 lines (36 loc) · 1.24 KB
/
peerConfig.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
package DAG
import "time"
// DefaultIP Using 127.0.0.1 for local test network.
const DefaultIP = "127.0.0.1"
const DefaultPort = 8000
const DefaultTcpPort = 9000
const DefaultK = 2
const DefaultNeighborRefreshTimeGap = 5 * time.Second // time.Minute
const DefaultFirstJoinListenWaitingTime = 3 * time.Second
const DefaultRefreshTime = 5 * time.Second
const DefaultTcpLength = 8 // int64
// Methods
//const TcpMethodJoin = 0
//const UdpMethodRefresh = 1
//const UdpMethodExit = 2
//const MethodReceiveGradient = 3 // Deal Local Training Result Reached.
//const TcpMethodReceiveModel = 4 // Deal Blockchain Training Result Broadcast.
//const TcpMethodCheckModel = 5 // Check Model Training Result.
// TCP Methods
const (
TcpMethodJoin = iota
MethodReceiveGradient // Deal Local Training Result Reached.
TcpMethodReceiveModel // Deal Blockchain Training Result Broadcast.
TcpMethodCheckModel // Check Model Training Result.
TcpMethodReleaseGradient
TcpMethodReleaseModel
TcpMethodGetModel
TcpMethodGetModelScore
TcpMethodExchangeGH
)
// UDP Methods
const (
UdpMethodRefresh = iota // Request Neighbor PeerInfo.
UdpMethodReceive // Receive Neighbor PeerInfo from other Peers.
UdpMethodExit // Remove Neighbor Exited.
)