-
Notifications
You must be signed in to change notification settings - Fork 8
/
connections.go
43 lines (34 loc) · 1.24 KB
/
connections.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
package types
import "net"
// NodeType is the type of peer (farmer, full node, etc)
type NodeType uint8
const (
// NodeTypeFullNode NodeType for full node
NodeTypeFullNode NodeType = 1
// NodeTypeHarvester NodeType for Harvester
NodeTypeHarvester NodeType = 2
// NodeTypeFarmer NodeType for Farmer
NodeTypeFarmer NodeType = 3
// NodeTypeTimelord NodeType for Timelord
NodeTypeTimelord NodeType = 4
// NodeTypeIntroducer NodeType for Introducer
NodeTypeIntroducer NodeType = 5
// NodeTypeWallet NodeType for Wallet
NodeTypeWallet NodeType = 6
)
// Connection represents a single peer or internal connection
type Connection struct {
BytesRead uint64 `json:"bytes_read"`
BytesWritten uint64 `json:"bytes_written"`
//CreationTime // @TODO parse to time - is seconds as float
//LastMessageTime // @TODO parse to time - is seconds as float
LocalPort uint16 `json:"local_port"`
NodeID string `json:"node_id"`
PeakHash string `json:"peak_hash"`
PeakHeight uint32 `json:"peak_height"`
PeakWeight Uint128 `json:"peak_weight"`
PeerHost net.IP `json:"peer_host"`
PeerPort uint16 `json:"peer_port"`
PeerServerPort uint16 `json:"peer_server_port"`
Type NodeType `json:"type"`
}