Fix lint errors, add initial namespace rpc
This commit is contained in:
parent
06700c1dc4
commit
07bbeafa3b
10 changed files with 1786 additions and 1269 deletions
106
proto/headscale/v1/rpc.proto
Normal file
106
proto/headscale/v1/rpc.proto
Normal file
|
@ -0,0 +1,106 @@
|
|||
syntax = "proto3";
|
||||
package headscale.v1;
|
||||
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
enum RegisterMethod {
|
||||
REGISTER_METHOD_UNSPECIFIED = 0;
|
||||
REGISTER_METHOD_AUTH_KEY = 1;
|
||||
REGISTER_METHOD_CLI = 2;
|
||||
REGISTER_METHOD_OIDC = 3;
|
||||
}
|
||||
|
||||
// message PreAuthKey {
|
||||
// uint64 id = 1;
|
||||
// string key = 2;
|
||||
// uint32 namespace_id = 3;
|
||||
// Namespace namespace = 4;
|
||||
// bool reusable = 5;
|
||||
// bool ephemeral = 6;
|
||||
// bool used = 7;
|
||||
//
|
||||
// google.protobuf.Timestamp created_at = 8;
|
||||
// google.protobuf.Timestamp expiration = 9;
|
||||
// }
|
||||
|
||||
message GetMachineRequest {
|
||||
uint64 machine_id = 1;
|
||||
}
|
||||
|
||||
message GetMachineResponse {
|
||||
uint64 id = 1;
|
||||
string machine_key = 2;
|
||||
string node_key = 3;
|
||||
string disco_key = 4;
|
||||
string ip_address = 5;
|
||||
string name = 6;
|
||||
uint32 namespace_id = 7;
|
||||
|
||||
bool registered = 8;
|
||||
RegisterMethod register_method = 9;
|
||||
uint32 auth_key_id = 10;
|
||||
// PreAuthKey auth_key = 11;
|
||||
|
||||
google.protobuf.Timestamp last_seen = 12;
|
||||
google.protobuf.Timestamp last_successful_update = 13;
|
||||
google.protobuf.Timestamp expiry = 14;
|
||||
|
||||
// bytes host_info = 15;
|
||||
// bytes endpoints = 16;
|
||||
// bytes enabled_routes = 17;
|
||||
|
||||
// google.protobuf.Timestamp created_at = 18;
|
||||
// google.protobuf.Timestamp updated_at = 19;
|
||||
// google.protobuf.Timestamp deleted_at = 20;
|
||||
}
|
||||
|
||||
message CreateNamespaceRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message CreateNamespaceResponse {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DeleteNamespaceRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DeleteNamespaceResponse {
|
||||
}
|
||||
|
||||
message ListNamespacesRequest {
|
||||
}
|
||||
|
||||
message ListNamespacesResponse {
|
||||
repeated string namespaces = 1;
|
||||
}
|
||||
|
||||
service HeadscaleService {
|
||||
rpc GetMachine(GetMachineRequest) returns(GetMachineResponse) {
|
||||
option(google.api.http) = {
|
||||
get : "/api/v1/machine/{machine_id}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc CreateNamespace(CreateNamespaceRequest) returns(CreateNamespaceResponse) {
|
||||
option(google.api.http) = {
|
||||
post : "/api/v1/namespace"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc DeleteNamespace(DeleteNamespaceRequest) returns(DeleteNamespaceResponse) {
|
||||
option(google.api.http) = {
|
||||
delete : "/api/v1/namespace"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListNamespaces(ListNamespacesRequest) returns(ListNamespacesResponse) {
|
||||
option(google.api.http) = {
|
||||
get : "/api/v1/namespace"
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package headscale.v1;
|
||||
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "options/gorm.proto";
|
||||
|
||||
enum RegisterMethod {
|
||||
AUTH_KEY = 0;
|
||||
CLI = 1;
|
||||
OIDC = 2;
|
||||
}
|
||||
|
||||
message Namespace {
|
||||
string Name = 1;
|
||||
}
|
||||
|
||||
message PreAuthKey {
|
||||
uint64 ID = 1;
|
||||
string Key = 2;
|
||||
uint32 NamespaceID = 3;
|
||||
Namespace Namespace = 4;
|
||||
bool Reusable = 5;
|
||||
bool Ephemeral = 6;
|
||||
bool Used = 7;
|
||||
|
||||
google.protobuf.Timestamp CreatedAt = 8;
|
||||
google.protobuf.Timestamp Expiration = 9;
|
||||
}
|
||||
|
||||
message GetMachineRequest {
|
||||
uint64 machine_id = 1;
|
||||
}
|
||||
|
||||
message Machine {
|
||||
option(gorm.opts).ormable = true;
|
||||
uint64 ID = 1;
|
||||
string MachineKey = 2;
|
||||
string NodeKey = 3;
|
||||
string DiscoKey = 4;
|
||||
string IPAddress = 5;
|
||||
string Name = 6;
|
||||
uint32 NamespaceID = 7;
|
||||
|
||||
bool Registered = 8;
|
||||
RegisterMethod RegisterMethod = 9;
|
||||
uint32 AuthKeyID = 10;
|
||||
PreAuthKey AuthKey = 11;
|
||||
|
||||
google.protobuf.Timestamp LastSeen = 12;
|
||||
google.protobuf.Timestamp LastSuccessfulUpdate = 13;
|
||||
google.protobuf.Timestamp Expiry = 14;
|
||||
|
||||
bytes HostInfo = 15;
|
||||
bytes Endpoints = 16;
|
||||
bytes EnabledRoutes = 17;
|
||||
|
||||
google.protobuf.Timestamp CreatedAt = 18;
|
||||
google.protobuf.Timestamp UpdatedAt = 19;
|
||||
google.protobuf.Timestamp DeletedAt = 20;
|
||||
}
|
||||
|
||||
// Gin Router will prefix this with /api/v1
|
||||
service HeadscaleService {
|
||||
rpc GetMachine(GetMachineRequest) returns(Machine) {
|
||||
option(google.api.http) = {
|
||||
get : "/api/v1/machine/{machine_id}"
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue