diff --git a/proto/headscale/v1/headscale.proto b/proto/headscale/v1/headscale.proto index 40d9be2a..4464cf2f 100644 --- a/proto/headscale/v1/headscale.proto +++ b/proto/headscale/v1/headscale.proto @@ -126,17 +126,31 @@ service HeadscaleService { // --- Machine end --- // --- Route start --- - rpc GetMachineRoute(GetMachineRouteRequest) returns (GetMachineRouteResponse) { + rpc GetRoutes(GetRoutesRequest) returns (GetRoutesResponse) { + option (google.api.http) = { + get: "/api/v1/routes" + }; + } + + rpc EnableRoute(EnableRouteRequest) returns (EnableRouteResponse) { + option (google.api.http) = { + post: "/api/v1/routes/{route_id}/enable" + }; + } + + rpc DisableRoute(DisableRouteRequest) returns (DisableRouteResponse) { + option (google.api.http) = { + post: "/api/v1/routes/{route_id}/disable" + }; + } + + + rpc GetMachineRoutes(GetMachineRoutesRequest) returns (GetMachineRoutesResponse) { option (google.api.http) = { get: "/api/v1/machine/{machine_id}/routes" }; } - rpc EnableMachineRoutes(EnableMachineRoutesRequest) returns (EnableMachineRoutesResponse) { - option (google.api.http) = { - post: "/api/v1/machine/{machine_id}/routes" - }; - } // --- Route end --- // --- ApiKeys start --- diff --git a/proto/headscale/v1/routes.proto b/proto/headscale/v1/routes.proto index 353c4294..e55e7694 100644 --- a/proto/headscale/v1/routes.proto +++ b/proto/headscale/v1/routes.proto @@ -2,24 +2,47 @@ syntax = "proto3"; package headscale.v1; option go_package = "github.com/juanfont/headscale/gen/go/v1"; -message Routes { - repeated string advertised_routes = 1; - repeated string enabled_routes = 2; +import "google/protobuf/timestamp.proto"; +import "headscale/v1/machine.proto"; + +message Route { + uint64 id = 1; + Machine machine = 2; + string prefix = 3; + bool advertised = 4; + bool enabled = 5; + bool is_primary = 6; + + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; + google.protobuf.Timestamp deleted_at = 9; } -message GetMachineRouteRequest { +message GetRoutesRequest { +} + +message GetRoutesResponse { + repeated Route routes = 1; +} + +message EnableRouteRequest { + uint64 route_id = 1; +} + +message EnableRouteResponse { +} + +message DisableRouteRequest { + uint64 route_id = 1; +} + +message DisableRouteResponse { +} + +message GetMachineRoutesRequest { uint64 machine_id = 1; } -message GetMachineRouteResponse { - Routes routes = 1; -} - -message EnableMachineRoutesRequest { - uint64 machine_id = 1; - repeated string routes = 2; -} - -message EnableMachineRoutesResponse { - Routes routes = 1; -} +message GetMachineRoutesResponse { + repeated Route routes = 1; +} \ No newline at end of file