2021-10-30 16:29:41 +02:00
|
|
|
syntax = "proto3";
|
|
|
|
package headscale.v1;
|
|
|
|
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
|
|
|
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
import "headscale/v1/user.proto";
|
2021-11-04 23:02:10 +01:00
|
|
|
import "headscale/v1/preauthkey.proto";
|
2023-09-24 13:42:05 +02:00
|
|
|
import "headscale/v1/node.proto";
|
2021-11-04 23:02:10 +01:00
|
|
|
import "headscale/v1/routes.proto";
|
2022-01-25 23:11:15 +01:00
|
|
|
import "headscale/v1/apikey.proto";
|
2021-11-04 23:02:10 +01:00
|
|
|
// import "headscale/v1/device.proto";
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
service HeadscaleService {
|
2023-01-17 17:50:52 +01:00
|
|
|
// --- User start ---
|
|
|
|
rpc GetUser(GetUserRequest) returns(GetUserResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
get : "/api/v1/user/{name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc CreateUser(CreateUserRequest) returns(CreateUserResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/user"
|
|
|
|
body : "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc RenameUser(RenameUserRequest) returns(RenameUserResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/user/{old_name}/rename/{new_name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc DeleteUser(DeleteUserRequest) returns(DeleteUserResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
delete : "/api/v1/user/{name}"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc ListUsers(ListUsersRequest) returns(ListUsersResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
get : "/api/v1/user"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2023-01-17 17:50:52 +01:00
|
|
|
// --- User end ---
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// --- PreAuthKeys start ---
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc CreatePreAuthKey(CreatePreAuthKeyRequest) returns(CreatePreAuthKeyResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/preauthkey"
|
|
|
|
body : "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc ExpirePreAuthKey(ExpirePreAuthKeyRequest) returns(ExpirePreAuthKeyResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/preauthkey/expire"
|
|
|
|
body : "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc ListPreAuthKeys(ListPreAuthKeysRequest) returns(ListPreAuthKeysResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
get : "/api/v1/preauthkey"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
// --- PreAuthKeys end ---
|
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
// --- Node start ---
|
|
|
|
rpc DebugCreateNode(DebugCreateNodeRequest) returns(DebugCreateNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/debug/node"
|
2023-01-17 17:50:52 +01:00
|
|
|
body : "*"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2021-10-30 16:29:41 +02:00
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc GetNode(GetNodeRequest) returns(GetNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
get : "/api/v1/node/{node_id}"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc SetTags(SetTagsRequest) returns(SetTagsResponse) {
|
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/node/{node_id}/tags"
|
2023-01-17 17:50:52 +01:00
|
|
|
body : "*"
|
2022-04-15 13:11:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc RegisterNode(RegisterNodeRequest) returns(RegisterNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/node/register"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc DeleteNode(DeleteNodeRequest) returns(DeleteNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
delete : "/api/v1/node/{node_id}"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc ExpireNode(ExpireNodeRequest) returns(ExpireNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/node/{node_id}/expire"
|
2021-11-21 14:40:04 +01:00
|
|
|
};
|
|
|
|
}
|
2022-03-13 22:03:20 +01:00
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc RenameNode(RenameNodeRequest) returns(RenameNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/node/{node_id}/rename/{new_name}"
|
2022-03-13 22:03:20 +01:00
|
|
|
};
|
|
|
|
}
|
2021-11-21 14:40:04 +01:00
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc ListNodes(ListNodesRequest) returns(ListNodesResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
get : "/api/v1/node"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
2022-05-01 15:34:40 +02:00
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc MoveNode(MoveNodeRequest) returns(MoveNodeResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
post : "/api/v1/node/{node_id}/user"
|
2022-05-01 15:34:40 +02:00
|
|
|
};
|
|
|
|
}
|
2023-09-24 13:42:05 +02:00
|
|
|
// --- Node end ---
|
2021-11-04 23:02:10 +01:00
|
|
|
|
|
|
|
// --- Route start ---
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc GetRoutes(GetRoutesRequest) returns(GetRoutesResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
get : "/api/v1/routes"
|
2022-11-25 18:50:12 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc EnableRoute(EnableRouteRequest) returns(EnableRouteResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/routes/{route_id}/enable"
|
2022-11-25 18:50:12 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc DisableRoute(DisableRouteRequest) returns(DisableRouteResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/routes/{route_id}/disable"
|
2021-11-04 23:02:10 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-09-24 13:42:05 +02:00
|
|
|
rpc GetNodeRoutes(GetNodeRoutesRequest) returns(GetNodeRoutesResponse) {
|
2023-01-17 17:50:52 +01:00
|
|
|
option(google.api.http) = {
|
2023-09-24 13:42:05 +02:00
|
|
|
get : "/api/v1/node/{node_id}/routes"
|
2021-10-30 16:29:41 +02:00
|
|
|
};
|
|
|
|
}
|
2022-11-25 18:50:12 +01:00
|
|
|
|
2023-03-06 09:05:40 +01:00
|
|
|
rpc DeleteRoute(DeleteRouteRequest) returns(DeleteRouteResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
delete : "/api/v1/routes/{route_id}"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// --- Route end ---
|
|
|
|
|
2022-01-25 23:11:15 +01:00
|
|
|
// --- ApiKeys start ---
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc CreateApiKey(CreateApiKeyRequest) returns(CreateApiKeyResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/apikey"
|
|
|
|
body : "*"
|
2022-01-25 23:11:15 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc ExpireApiKey(ExpireApiKeyRequest) returns(ExpireApiKeyResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
post : "/api/v1/apikey/expire"
|
|
|
|
body : "*"
|
2022-01-25 23:11:15 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-17 17:50:52 +01:00
|
|
|
rpc ListApiKeys(ListApiKeysRequest) returns(ListApiKeysResponse) {
|
|
|
|
option(google.api.http) = {
|
|
|
|
get : "/api/v1/apikey"
|
2022-01-25 23:11:15 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
// --- ApiKeys end ---
|
|
|
|
|
2021-11-04 23:02:10 +01:00
|
|
|
// Implement Tailscale API
|
|
|
|
// rpc GetDevice(GetDeviceRequest) returns(GetDeviceResponse) {
|
|
|
|
// option(google.api.http) = {
|
|
|
|
// get : "/api/v1/device/{id}"
|
|
|
|
// };
|
|
|
|
// }
|
|
|
|
|
|
|
|
// rpc DeleteDevice(DeleteDeviceRequest) returns(DeleteDeviceResponse) {
|
|
|
|
// option(google.api.http) = {
|
|
|
|
// delete : "/api/v1/device/{id}"
|
|
|
|
// };
|
|
|
|
// }
|
|
|
|
|
|
|
|
// rpc GetDeviceRoutes(GetDeviceRoutesRequest) returns(GetDeviceRoutesResponse) {
|
|
|
|
// option(google.api.http) = {
|
|
|
|
// get : "/api/v1/device/{id}/routes"
|
|
|
|
// };
|
|
|
|
// }
|
|
|
|
|
|
|
|
// rpc EnableDeviceRoutes(EnableDeviceRoutesRequest) returns(EnableDeviceRoutesResponse) {
|
|
|
|
// option(google.api.http) = {
|
|
|
|
// post : "/api/v1/device/{id}/routes"
|
|
|
|
// };
|
|
|
|
// }
|
2021-10-30 16:29:41 +02:00
|
|
|
}
|