-
Notifications
You must be signed in to change notification settings - Fork 0
/
master.go
52 lines (42 loc) · 949 Bytes
/
master.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
package commonCommunication
type Master struct {
IP string `json:"ip"`
Port int `json:"port"`
Info string `json:"info"`
Peers []Peer `json:"peers"`
Puk string `json:"puk"`
Prk string `json:"prk"`
}
type Peer struct {
IP string `json:"ip"`
Port int `json:"port"`
Info string `json:"info"`
Key string `json:"key"`
}
func CreateCluster(port int, limit int, crypto bool) (Master, error) {
return Master{}, nil
}
func (this Master) Listen() error {
defer func(this Master) {
_ = this.CloseCluster()
}(this)
return nil
}
func (this Master) CloseCluster() error {
return nil
}
func (this Master) GetPublicKey() string {
return this.Puk
}
func (this Master) GetPrivateKey() string {
return this.Prk
}
func (this Master) FetchPeerList() []Peer {
return this.Peers
}
func (this Master) Broadcast(info string) error {
return nil
}
func (this Master) SendInfoToPeer(peer Peer, info string) error {
return nil
}