mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-02 19:39:17 +01:00
079d35eada
* feature: add peer sync and a server public key endpoints * test: add Management.Sync() gRpc endpoint test * feat: implement peer sync * docs: added some comments to the Management server * chore: use for loop over channel when monitoring peer updates * fix: exit infinite loop when sending updates to peers * test: add multiple concurrent peers test for management service * chore: remove unused test * fix: reduce the amount peers for a concurrent peer update test Co-authored-by: braginini <m.bragin@wiretrustee.com>
30 lines
729 B
Go
30 lines
729 B
Go
package management
|
|
|
|
// Account represents a unique account of the system
|
|
type Account struct {
|
|
Id string
|
|
SetupKeys map[string]*SetupKey
|
|
Peers map[string]*Peer
|
|
}
|
|
|
|
// SetupKey represents a pre-authorized key used to register machines (peers)
|
|
// One key might have multiple machines
|
|
type SetupKey struct {
|
|
Key string
|
|
}
|
|
|
|
// Peer represents a machine connected to the network.
|
|
// The Peer is a Wireguard peer identified by a public key
|
|
type Peer struct {
|
|
// Wireguard public key
|
|
Key string
|
|
// A setup key this peer was registered with
|
|
SetupKey *SetupKey
|
|
}
|
|
|
|
type Store interface {
|
|
PeerExists(peerKey string) bool
|
|
AddPeer(setupKey string, peerKey string) error
|
|
GetPeersForAPeer(peerKey string) ([]string, error)
|
|
}
|