40 lines
658 B
Go
40 lines
658 B
Go
// The package `m` contains models shared between the hub and peer programs.
|
|
package m
|
|
|
|
type PeerConfig struct {
|
|
PeerIP byte
|
|
HubAddress string
|
|
Network []byte
|
|
APIKey string
|
|
IP []byte
|
|
Port uint16
|
|
Mediator bool
|
|
EncPubKey []byte
|
|
EncPrivKey []byte
|
|
SignPubKey []byte
|
|
SignPrivKey []byte
|
|
}
|
|
|
|
type Peer struct {
|
|
PeerIP byte
|
|
Name string
|
|
IP []byte
|
|
Port uint16
|
|
Mediator bool
|
|
EncPubKey []byte
|
|
SignPubKey []byte
|
|
}
|
|
|
|
type NetworkState struct {
|
|
HubAddress string
|
|
|
|
// The requester's data:
|
|
Network []byte
|
|
PeerIP byte
|
|
IP []byte
|
|
Port uint16
|
|
|
|
// All peer data.
|
|
Peers [256]*Peer
|
|
}
|