mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
* 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>
64 lines
1.5 KiB
Protocol Buffer
64 lines
1.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
option go_package = "/proto";
|
|
|
|
package management;
|
|
|
|
service ManagementService {
|
|
|
|
rpc RegisterPeer(RegisterPeerRequest) returns (RegisterPeerResponse) {}
|
|
|
|
// Sync enables peer synchronization. Each peer that is connected to this stream will receive updates from the server.
|
|
// For example, if a new peer has been added to an account all other connected peers will receive this peer's Wireguard public key as an update
|
|
// The initial SyncResponse contains all of the available peers so the local state can be refreshed
|
|
rpc Sync(EncryptedMessage) returns (stream EncryptedMessage) {}
|
|
|
|
// Exposes a Wireguard public key of the Management service.
|
|
// This key is used to support message encryption between client and server
|
|
rpc GetServerKey(Empty) returns (ServerKeyResponse) {}
|
|
|
|
// health check endpoint
|
|
rpc isHealthy(Empty) returns (Empty) {}
|
|
}
|
|
|
|
message EncryptedMessage {
|
|
// Wireguard public key
|
|
string wgPubKey = 1;
|
|
|
|
// encrypted message Body
|
|
bytes body = 2;
|
|
}
|
|
|
|
message SyncRequest {
|
|
|
|
}
|
|
|
|
message SyncResponse {
|
|
// A list of peers available
|
|
repeated string peers = 1;
|
|
}
|
|
|
|
message RegisterPeerRequest {
|
|
// Wireguard public key
|
|
string key = 1;
|
|
|
|
// Pre-authorized setup key
|
|
string setupKey = 2;
|
|
}
|
|
|
|
message RegisterPeerResponse {
|
|
|
|
}
|
|
|
|
message ServerKeyResponse {
|
|
// Server's Wireguard public key
|
|
string key = 1;
|
|
// Key expiration timestamp after which the key should be fetched again by the client
|
|
google.protobuf.Timestamp expiresAt = 2;
|
|
}
|
|
|
|
message Empty {
|
|
|
|
} |