mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-17 16:07:31 +00:00
Compare commits
50 Commits
fix-typo-s
...
rerouting
Author | SHA1 | Date | |
---|---|---|---|
![]() |
faa75f97ba | ||
![]() |
70611746cb | ||
![]() |
7d4fbe65ea | ||
![]() |
dd48d09812 | ||
![]() |
a9e2179b9f | ||
![]() |
b49e46a4c3 | ||
![]() |
635027038f | ||
![]() |
fad43760ef | ||
![]() |
68d2eaaaa6 | ||
![]() |
cd2d2ef7e5 | ||
![]() |
1ce3d95d95 | ||
![]() |
20d599ae34 | ||
![]() |
347d4d0ca5 | ||
![]() |
1d9cd88053 | ||
![]() |
37a031d13e | ||
![]() |
b5f1ae3d90 | ||
![]() |
358ed64b98 | ||
![]() |
d606b5a21e | ||
![]() |
091ade10cf | ||
![]() |
de4e19017f | ||
![]() |
5e89794433 | ||
![]() |
52ab2a8ffd | ||
![]() |
cf35ae94d0 | ||
![]() |
60be739a3b | ||
![]() |
a76115b9e4 | ||
![]() |
28ef3145c5 | ||
![]() |
c78403691c | ||
![]() |
4da462917c | ||
![]() |
87bfb53c1c | ||
![]() |
e26e3303cd | ||
![]() |
123ace4fb0 | ||
![]() |
4158447547 | ||
![]() |
7e3119be9b | ||
![]() |
0bf41646e9 | ||
![]() |
5322373fa1 | ||
![]() |
ecb7dfad15 | ||
![]() |
cffb7ad32f | ||
![]() |
ae3d42805c | ||
![]() |
3e85bfa56e | ||
![]() |
d4491bf340 | ||
![]() |
03accae98c | ||
![]() |
b376f58e0e | ||
![]() |
940dbc7706 | ||
![]() |
3da872bb30 | ||
![]() |
d71b802d81 | ||
![]() |
1dcc98fcbb | ||
![]() |
ee9e64e57b | ||
![]() |
552f4bf19b | ||
![]() |
f4519cecf5 | ||
![]() |
e88ff0f7d9 |
@@ -13,7 +13,7 @@ func (h *Headscale) generateMapResponse(
|
|||||||
Str("func", "generateMapResponse").
|
Str("func", "generateMapResponse").
|
||||||
Str("machine", mapRequest.Hostinfo.Hostname).
|
Str("machine", mapRequest.Hostinfo.Hostname).
|
||||||
Msg("Creating Map response")
|
Msg("Creating Map response")
|
||||||
node, err := machine.toNode(h.cfg.BaseDomain, h.cfg.DNSConfig)
|
node, err := h.toNode(*machine, h.cfg.BaseDomain, h.cfg.DNSConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().
|
log.Error().
|
||||||
Caller().
|
Caller().
|
||||||
@@ -37,7 +37,7 @@ func (h *Headscale) generateMapResponse(
|
|||||||
|
|
||||||
profiles := h.getMapResponseUserProfiles(*machine, peers)
|
profiles := h.getMapResponseUserProfiles(*machine, peers)
|
||||||
|
|
||||||
nodePeers, err := peers.toNodes(h.cfg.BaseDomain, h.cfg.DNSConfig)
|
nodePeers, err := h.toNodes(peers, h.cfg.BaseDomain, h.cfg.DNSConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().
|
log.Error().
|
||||||
Caller().
|
Caller().
|
||||||
|
12
app.go
12
app.go
@@ -219,6 +219,16 @@ func (h *Headscale) expireEphemeralNodes(milliSeconds int64) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) failoverSubnetRoutes(milliSeconds int64) {
|
||||||
|
ticker := time.NewTicker(time.Duration(milliSeconds) * time.Millisecond)
|
||||||
|
for range ticker.C {
|
||||||
|
err := h.handlePrimarySubnetFailover()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("failed to handle primary subnet failover")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Headscale) expireEphemeralNodesWorker() {
|
func (h *Headscale) expireEphemeralNodesWorker() {
|
||||||
namespaces, err := h.ListNamespaces()
|
namespaces, err := h.ListNamespaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -497,6 +507,8 @@ func (h *Headscale) Serve() error {
|
|||||||
|
|
||||||
go h.expireEphemeralNodes(updateInterval)
|
go h.expireEphemeralNodes(updateInterval)
|
||||||
|
|
||||||
|
go h.failoverSubnetRoutes(updateInterval)
|
||||||
|
|
||||||
if zl.GlobalLevel() == zl.TraceLevel {
|
if zl.GlobalLevel() == zl.TraceLevel {
|
||||||
zerolog.RespLog = true
|
zerolog.RespLog = true
|
||||||
} else {
|
} else {
|
||||||
|
@@ -11,29 +11,28 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Base10 = 10
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(routesCmd)
|
rootCmd.AddCommand(routesCmd)
|
||||||
|
|
||||||
listRoutesCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)")
|
listRoutesCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)")
|
||||||
err := listRoutesCmd.MarkFlagRequired("identifier")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf(err.Error())
|
|
||||||
}
|
|
||||||
routesCmd.AddCommand(listRoutesCmd)
|
routesCmd.AddCommand(listRoutesCmd)
|
||||||
|
|
||||||
enableRouteCmd.Flags().
|
enableRouteCmd.Flags().Uint64P("route", "r", 0, "Route identifier (ID)")
|
||||||
StringSliceP("route", "r", []string{}, "List (or repeated flags) of routes to enable")
|
err := enableRouteCmd.MarkFlagRequired("route")
|
||||||
enableRouteCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)")
|
|
||||||
enableRouteCmd.Flags().BoolP("all", "a", false, "All routes from host")
|
|
||||||
|
|
||||||
err = enableRouteCmd.MarkFlagRequired("identifier")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
routesCmd.AddCommand(enableRouteCmd)
|
routesCmd.AddCommand(enableRouteCmd)
|
||||||
|
|
||||||
nodeCmd.AddCommand(routesCmd)
|
disableRouteCmd.Flags().Uint64P("route", "r", 0, "Route identifier (ID)")
|
||||||
|
err = disableRouteCmd.MarkFlagRequired("route")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
|
routesCmd.AddCommand(disableRouteCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
var routesCmd = &cobra.Command{
|
var routesCmd = &cobra.Command{
|
||||||
@@ -44,7 +43,7 @@ var routesCmd = &cobra.Command{
|
|||||||
|
|
||||||
var listRoutesCmd = &cobra.Command{
|
var listRoutesCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List routes advertised and enabled by a given node",
|
Short: "List all routes",
|
||||||
Aliases: []string{"ls", "show"},
|
Aliases: []string{"ls", "show"},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
output, _ := cmd.Flags().GetString("output")
|
output, _ := cmd.Flags().GetString("output")
|
||||||
@@ -64,28 +63,51 @@ var listRoutesCmd = &cobra.Command{
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
request := &v1.GetMachineRouteRequest{
|
var routes []*v1.Route
|
||||||
MachineId: machineID,
|
|
||||||
|
if machineID == 0 {
|
||||||
|
response, err := client.GetRoutes(ctx, &v1.GetRoutesRequest{})
|
||||||
|
if err != nil {
|
||||||
|
ErrorOutput(
|
||||||
|
err,
|
||||||
|
fmt.Sprintf("Cannot get nodes: %s", status.Convert(err).Message()),
|
||||||
|
output,
|
||||||
|
)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if output != "" {
|
||||||
|
SuccessOutput(response.Routes, "", output)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
routes = response.Routes
|
||||||
|
} else {
|
||||||
|
response, err := client.GetMachineRoutes(ctx, &v1.GetMachineRoutesRequest{
|
||||||
|
MachineId: machineID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ErrorOutput(
|
||||||
|
err,
|
||||||
|
fmt.Sprintf("Cannot get routes for machine %d: %s", machineID, status.Convert(err).Message()),
|
||||||
|
output,
|
||||||
|
)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if output != "" {
|
||||||
|
SuccessOutput(response.Routes, "", output)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
routes = response.Routes
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := client.GetMachineRoute(ctx, request)
|
tableData := routesToPtables(routes)
|
||||||
if err != nil {
|
|
||||||
ErrorOutput(
|
|
||||||
err,
|
|
||||||
fmt.Sprintf("Cannot get nodes: %s", status.Convert(err).Message()),
|
|
||||||
output,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if output != "" {
|
|
||||||
SuccessOutput(response.Routes, "", output)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tableData := routesToPtables(response.Routes)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ErrorOutput(err, fmt.Sprintf("Error converting to table: %s", err), output)
|
ErrorOutput(err, fmt.Sprintf("Error converting to table: %s", err), output)
|
||||||
|
|
||||||
@@ -107,16 +129,12 @@ var listRoutesCmd = &cobra.Command{
|
|||||||
|
|
||||||
var enableRouteCmd = &cobra.Command{
|
var enableRouteCmd = &cobra.Command{
|
||||||
Use: "enable",
|
Use: "enable",
|
||||||
Short: "Set the enabled routes for a given node",
|
Short: "Set a route as enabled",
|
||||||
Long: `This command will take a list of routes that will _replace_
|
Long: `This command will make as enabled a given route.`,
|
||||||
the current set of routes on a given node.
|
|
||||||
If you would like to disable a route, simply run the command again, but
|
|
||||||
omit the route you do not want to enable.
|
|
||||||
`,
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
output, _ := cmd.Flags().GetString("output")
|
output, _ := cmd.Flags().GetString("output")
|
||||||
|
|
||||||
machineID, err := cmd.Flags().GetUint64("identifier")
|
routeID, err := cmd.Flags().GetUint64("route")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ErrorOutput(
|
ErrorOutput(
|
||||||
err,
|
err,
|
||||||
@@ -131,52 +149,13 @@ omit the route you do not want to enable.
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
var routes []string
|
response, err := client.EnableRoute(ctx, &v1.EnableRouteRequest{
|
||||||
|
RouteId: routeID,
|
||||||
isAll, _ := cmd.Flags().GetBool("all")
|
})
|
||||||
if isAll {
|
|
||||||
response, err := client.GetMachineRoute(ctx, &v1.GetMachineRouteRequest{
|
|
||||||
MachineId: machineID,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ErrorOutput(
|
|
||||||
err,
|
|
||||||
fmt.Sprintf(
|
|
||||||
"Cannot get machine routes: %s\n",
|
|
||||||
status.Convert(err).Message(),
|
|
||||||
),
|
|
||||||
output,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
routes = response.GetRoutes().GetAdvertisedRoutes()
|
|
||||||
} else {
|
|
||||||
routes, err = cmd.Flags().GetStringSlice("route")
|
|
||||||
if err != nil {
|
|
||||||
ErrorOutput(
|
|
||||||
err,
|
|
||||||
fmt.Sprintf("Error getting routes from flag: %s", err),
|
|
||||||
output,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request := &v1.EnableMachineRoutesRequest{
|
|
||||||
MachineId: machineID,
|
|
||||||
Routes: routes,
|
|
||||||
}
|
|
||||||
|
|
||||||
response, err := client.EnableMachineRoutes(ctx, request)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ErrorOutput(
|
ErrorOutput(
|
||||||
err,
|
err,
|
||||||
fmt.Sprintf(
|
fmt.Sprintf("Cannot enable route %d: %s", routeID, status.Convert(err).Message()),
|
||||||
"Cannot register machine: %s\n",
|
|
||||||
status.Convert(err).Message(),
|
|
||||||
),
|
|
||||||
output,
|
output,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,50 +163,71 @@ omit the route you do not want to enable.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if output != "" {
|
if output != "" {
|
||||||
SuccessOutput(response.Routes, "", output)
|
SuccessOutput(response, "", output)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
tableData := routesToPtables(response.Routes)
|
var disableRouteCmd = &cobra.Command{
|
||||||
if err != nil {
|
Use: "disable",
|
||||||
ErrorOutput(err, fmt.Sprintf("Error converting to table: %s", err), output)
|
Short: "Set as disabled a given route",
|
||||||
|
Long: `This command will make as disabled a given route.`,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
output, _ := cmd.Flags().GetString("output")
|
||||||
|
|
||||||
return
|
routeID, err := cmd.Flags().GetUint64("route")
|
||||||
}
|
|
||||||
|
|
||||||
err = pterm.DefaultTable.WithHasHeader().WithData(tableData).Render()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ErrorOutput(
|
ErrorOutput(
|
||||||
err,
|
err,
|
||||||
fmt.Sprintf("Failed to render pterm table: %s", err),
|
fmt.Sprintf("Error getting machine id from flag: %s", err),
|
||||||
output,
|
output,
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx, client, conn, cancel := getHeadscaleCLIClient()
|
||||||
|
defer cancel()
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
|
response, err := client.DisableRoute(ctx, &v1.DisableRouteRequest{
|
||||||
|
RouteId: routeID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ErrorOutput(
|
||||||
|
err,
|
||||||
|
fmt.Sprintf("Cannot enable route %d: %s", routeID, status.Convert(err).Message()),
|
||||||
|
output,
|
||||||
|
)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if output != "" {
|
||||||
|
SuccessOutput(response, "", output)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// routesToPtables converts the list of routes to a nice table.
|
// routesToPtables converts the list of routes to a nice table.
|
||||||
func routesToPtables(routes *v1.Routes) pterm.TableData {
|
func routesToPtables(routes []*v1.Route) pterm.TableData {
|
||||||
tableData := pterm.TableData{{"Route", "Enabled"}}
|
tableData := pterm.TableData{{"ID", "Machine", "Prefix", "Advertised", "Enabled", "Primary"}}
|
||||||
|
|
||||||
for _, route := range routes.GetAdvertisedRoutes() {
|
for _, route := range routes {
|
||||||
enabled := isStringInSlice(routes.EnabledRoutes, route)
|
tableData = append(tableData,
|
||||||
|
[]string{
|
||||||
tableData = append(tableData, []string{route, strconv.FormatBool(enabled)})
|
strconv.FormatUint(route.Id, Base10),
|
||||||
|
route.Machine.GivenName,
|
||||||
|
route.Prefix,
|
||||||
|
strconv.FormatBool(route.Advertised),
|
||||||
|
strconv.FormatBool(route.Enabled),
|
||||||
|
strconv.FormatBool(route.IsPrimary),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return tableData
|
return tableData
|
||||||
}
|
}
|
||||||
|
|
||||||
func isStringInSlice(strs []string, s string) bool {
|
|
||||||
for _, s2 := range strs {
|
|
||||||
if s == s2 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
91
db.go
91
db.go
@@ -18,8 +18,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
dbVersion = "1"
|
dbVersion = "1"
|
||||||
errValueNotFound = Error("not found")
|
|
||||||
|
errValueNotFound = Error("not found")
|
||||||
|
ErrCannotParsePrefix = Error("cannot parse prefix")
|
||||||
)
|
)
|
||||||
|
|
||||||
// KV is a key-value store in a psql table. For future use...
|
// KV is a key-value store in a psql table. For future use...
|
||||||
@@ -79,6 +81,67 @@ func (h *Headscale) initDB() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = db.AutoMigrate(&Route{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if db.Migrator().HasColumn(&Machine{}, "enabled_routes") {
|
||||||
|
log.Info().Msgf("Database has legacy enabled_routes column in machine, migrating...")
|
||||||
|
|
||||||
|
type MachineAux struct {
|
||||||
|
ID uint64
|
||||||
|
EnabledRoutes IPPrefixes
|
||||||
|
}
|
||||||
|
|
||||||
|
machinesAux := []MachineAux{}
|
||||||
|
err := db.Table("machines").Select("id, enabled_routes").Scan(&machinesAux).Error
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Error accessing db")
|
||||||
|
}
|
||||||
|
for _, machine := range machinesAux {
|
||||||
|
for _, prefix := range machine.EnabledRoutes {
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Err(err).
|
||||||
|
Str("enabled_route", prefix.String()).
|
||||||
|
Msg("Error parsing enabled_route")
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
err = db.Preload("Machine").Where("machine_id = ? AND prefix = ?", machine.ID, IPPrefix(prefix)).First(&Route{}).Error
|
||||||
|
if err == nil {
|
||||||
|
log.Info().
|
||||||
|
Str("enabled_route", prefix.String()).
|
||||||
|
Msg("Route already migrated to new table, skipping")
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
route := Route{
|
||||||
|
MachineID: machine.ID,
|
||||||
|
Advertised: true,
|
||||||
|
Enabled: true,
|
||||||
|
Prefix: IPPrefix(prefix),
|
||||||
|
}
|
||||||
|
if err := h.db.Create(&route).Error; err != nil {
|
||||||
|
log.Error().Err(err).Msg("Error creating route")
|
||||||
|
} else {
|
||||||
|
log.Info().
|
||||||
|
Uint64("machine_id", route.MachineID).
|
||||||
|
Str("prefix", prefix.String()).
|
||||||
|
Msg("Route migrated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = db.Migrator().DropColumn(&Machine{}, "enabled_routes")
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Error dropping enabled_routes column")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = db.AutoMigrate(&Machine{})
|
err = db.AutoMigrate(&Machine{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -264,6 +327,30 @@ func (hi HostInfo) Value() (driver.Value, error) {
|
|||||||
return string(bytes), err
|
return string(bytes), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPPrefix netip.Prefix
|
||||||
|
|
||||||
|
func (i *IPPrefix) Scan(destination interface{}) error {
|
||||||
|
switch value := destination.(type) {
|
||||||
|
case string:
|
||||||
|
prefix, err := netip.ParsePrefix(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*i = IPPrefix(prefix)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("%w: unexpected data type %T", ErrCannotParsePrefix, destination)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value return json value, implement driver.Valuer interface.
|
||||||
|
func (i IPPrefix) Value() (driver.Value, error) {
|
||||||
|
prefixStr := netip.Prefix(i).String()
|
||||||
|
|
||||||
|
return prefixStr, nil
|
||||||
|
}
|
||||||
|
|
||||||
type IPPrefixes []netip.Prefix
|
type IPPrefixes []netip.Prefix
|
||||||
|
|
||||||
func (i *IPPrefixes) Scan(destination interface{}) error {
|
func (i *IPPrefixes) Scan(destination interface{}) error {
|
||||||
|
@@ -36,7 +36,7 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76,
|
0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76,
|
||||||
0x31, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
|
0x31, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
|
||||||
0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69,
|
0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69,
|
||||||
0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb1, 0x16, 0x0a, 0x10, 0x48, 0x65,
|
0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x81, 0x18, 0x0a, 0x10, 0x48, 0x65,
|
||||||
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77,
|
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77,
|
||||||
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21,
|
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21,
|
||||||
0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||||
@@ -51,9 +51,9 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x1a, 0x25, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e,
|
0x1a, 0x25, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e,
|
||||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52,
|
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a,
|
||||||
0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
|
0x01, 0x2a, 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
0x63, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x96, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65,
|
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x96, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
||||||
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e,
|
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e,
|
||||||
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
@@ -85,17 +85,17 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c,
|
||||||
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75,
|
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75,
|
||||||
0x74, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82,
|
0x74, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82,
|
||||||
0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x70,
|
0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
||||||
0x72, 0x65, 0x61, 0x75, 0x74, 0x68, 0x6b, 0x65, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x87, 0x01, 0x0a,
|
0x31, 0x2f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68, 0x6b, 0x65, 0x79, 0x12, 0x87, 0x01, 0x0a,
|
||||||
0x10, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65,
|
0x10, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65,
|
||||||
0x79, 0x12, 0x25, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31,
|
0x79, 0x12, 0x25, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31,
|
||||||
0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65,
|
0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65,
|
||||||
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73,
|
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73,
|
||||||
0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72,
|
0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x50, 0x72,
|
||||||
0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x61, 0x70,
|
||||||
0x31, 0x2f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68, 0x6b, 0x65, 0x79, 0x2f, 0x65, 0x78, 0x70,
|
0x69, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68, 0x6b, 0x65, 0x79, 0x2f,
|
||||||
0x69, 0x72, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x7a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72,
|
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x12, 0x7a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72,
|
||||||
0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
0x65, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
||||||
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65,
|
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65,
|
||||||
0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
@@ -110,8 +110,8 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x73, 0x74, 0x1a, 0x28, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76,
|
0x73, 0x74, 0x1a, 0x28, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76,
|
||||||
0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63,
|
0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63,
|
||||||
0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3,
|
0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3,
|
||||||
0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65,
|
0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31,
|
||||||
0x62, 0x75, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x75,
|
0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x75,
|
||||||
0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x1f, 0x2e, 0x68,
|
0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x1f, 0x2e, 0x68,
|
||||||
0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d,
|
0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d,
|
||||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e,
|
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e,
|
||||||
@@ -124,9 +124,9 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x53, 0x65, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
|
0x53, 0x65, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
|
||||||
0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
|
0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
|
||||||
0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82,
|
0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82,
|
||||||
0xd3, 0xe4, 0x93, 0x02, 0x26, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d,
|
0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
||||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f,
|
0x31, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69,
|
||||||
0x69, 0x64, 0x7d, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x80, 0x01, 0x0a, 0x0f,
|
0x6e, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x12, 0x80, 0x01, 0x0a, 0x0f,
|
||||||
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12,
|
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12,
|
||||||
0x24, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52,
|
0x24, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52,
|
||||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65,
|
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65,
|
||||||
@@ -175,24 +175,37 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e,
|
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e,
|
||||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f,
|
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f,
|
||||||
0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
|
0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
|
||||||
0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x8b,
|
0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x64,
|
||||||
0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75,
|
0x0a, 0x09, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x2e, 0x68, 0x65,
|
||||||
0x74, 0x65, 0x12, 0x24, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76,
|
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f,
|
||||||
0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74,
|
0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x68, 0x65,
|
||||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73,
|
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f,
|
||||||
0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3,
|
||||||
0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f,
|
||||||
0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31,
|
0x75, 0x74, 0x65, 0x73, 0x12, 0x7c, 0x0a, 0x0b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f,
|
||||||
0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e,
|
0x75, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e,
|
||||||
0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x97, 0x01, 0x0a,
|
0x76, 0x31, 0x2e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65,
|
||||||
0x13, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c,
|
||||||
0x75, 0x74, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65,
|
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
||||||
0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22,
|
||||||
0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29,
|
0x22, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73,
|
||||||
0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e,
|
0x2f, 0x7b, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x65, 0x6e, 0x61, 0x62,
|
||||||
0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
0x6c, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f,
|
||||||
|
0x75, 0x74, 0x65, 0x12, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e,
|
||||||
|
0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61,
|
||||||
|
0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75,
|
||||||
|
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93,
|
||||||
|
0x02, 0x23, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x74,
|
||||||
|
0x65, 0x73, 0x2f, 0x7b, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x64, 0x69,
|
||||||
|
0x73, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63,
|
||||||
|
0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x68, 0x65, 0x61,
|
||||||
|
0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63,
|
||||||
|
0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
|
0x74, 0x1a, 0x26, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31,
|
||||||
|
0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
||||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||||
0x25, 0x22, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69,
|
0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69,
|
||||||
0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f,
|
0x6e, 0x65, 0x2f, 0x7b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f,
|
||||||
0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||||
0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61,
|
0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61,
|
||||||
@@ -200,16 +213,16 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x65, 0x61, 0x64,
|
||||||
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41,
|
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41,
|
||||||
0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82,
|
0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82,
|
||||||
0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61,
|
0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
||||||
0x70, 0x69, 0x6b, 0x65, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x77, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x69,
|
0x31, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x12, 0x77, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x69,
|
||||||
0x72, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73,
|
0x72, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73,
|
||||||
0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x41, 0x70,
|
0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x41, 0x70,
|
||||||
0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x65,
|
0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x65,
|
||||||
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72,
|
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72,
|
||||||
0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||||
0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31,
|
0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69,
|
||||||
0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x2f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x3a, 0x01,
|
0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x2f, 0x65, 0x78, 0x70, 0x69, 0x72,
|
||||||
0x2a, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73,
|
0x65, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73,
|
||||||
0x12, 0x20, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e,
|
0x12, 0x20, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e,
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x73, 0x74, 0x1a, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76,
|
0x73, 0x74, 0x1a, 0x21, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76,
|
||||||
@@ -222,50 +235,54 @@ var file_headscale_v1_headscale_proto_rawDesc = []byte{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_headscale_v1_headscale_proto_goTypes = []interface{}{
|
var file_headscale_v1_headscale_proto_goTypes = []interface{}{
|
||||||
(*GetNamespaceRequest)(nil), // 0: headscale.v1.GetNamespaceRequest
|
(*GetNamespaceRequest)(nil), // 0: headscale.v1.GetNamespaceRequest
|
||||||
(*CreateNamespaceRequest)(nil), // 1: headscale.v1.CreateNamespaceRequest
|
(*CreateNamespaceRequest)(nil), // 1: headscale.v1.CreateNamespaceRequest
|
||||||
(*RenameNamespaceRequest)(nil), // 2: headscale.v1.RenameNamespaceRequest
|
(*RenameNamespaceRequest)(nil), // 2: headscale.v1.RenameNamespaceRequest
|
||||||
(*DeleteNamespaceRequest)(nil), // 3: headscale.v1.DeleteNamespaceRequest
|
(*DeleteNamespaceRequest)(nil), // 3: headscale.v1.DeleteNamespaceRequest
|
||||||
(*ListNamespacesRequest)(nil), // 4: headscale.v1.ListNamespacesRequest
|
(*ListNamespacesRequest)(nil), // 4: headscale.v1.ListNamespacesRequest
|
||||||
(*CreatePreAuthKeyRequest)(nil), // 5: headscale.v1.CreatePreAuthKeyRequest
|
(*CreatePreAuthKeyRequest)(nil), // 5: headscale.v1.CreatePreAuthKeyRequest
|
||||||
(*ExpirePreAuthKeyRequest)(nil), // 6: headscale.v1.ExpirePreAuthKeyRequest
|
(*ExpirePreAuthKeyRequest)(nil), // 6: headscale.v1.ExpirePreAuthKeyRequest
|
||||||
(*ListPreAuthKeysRequest)(nil), // 7: headscale.v1.ListPreAuthKeysRequest
|
(*ListPreAuthKeysRequest)(nil), // 7: headscale.v1.ListPreAuthKeysRequest
|
||||||
(*DebugCreateMachineRequest)(nil), // 8: headscale.v1.DebugCreateMachineRequest
|
(*DebugCreateMachineRequest)(nil), // 8: headscale.v1.DebugCreateMachineRequest
|
||||||
(*GetMachineRequest)(nil), // 9: headscale.v1.GetMachineRequest
|
(*GetMachineRequest)(nil), // 9: headscale.v1.GetMachineRequest
|
||||||
(*SetTagsRequest)(nil), // 10: headscale.v1.SetTagsRequest
|
(*SetTagsRequest)(nil), // 10: headscale.v1.SetTagsRequest
|
||||||
(*RegisterMachineRequest)(nil), // 11: headscale.v1.RegisterMachineRequest
|
(*RegisterMachineRequest)(nil), // 11: headscale.v1.RegisterMachineRequest
|
||||||
(*DeleteMachineRequest)(nil), // 12: headscale.v1.DeleteMachineRequest
|
(*DeleteMachineRequest)(nil), // 12: headscale.v1.DeleteMachineRequest
|
||||||
(*ExpireMachineRequest)(nil), // 13: headscale.v1.ExpireMachineRequest
|
(*ExpireMachineRequest)(nil), // 13: headscale.v1.ExpireMachineRequest
|
||||||
(*RenameMachineRequest)(nil), // 14: headscale.v1.RenameMachineRequest
|
(*RenameMachineRequest)(nil), // 14: headscale.v1.RenameMachineRequest
|
||||||
(*ListMachinesRequest)(nil), // 15: headscale.v1.ListMachinesRequest
|
(*ListMachinesRequest)(nil), // 15: headscale.v1.ListMachinesRequest
|
||||||
(*MoveMachineRequest)(nil), // 16: headscale.v1.MoveMachineRequest
|
(*MoveMachineRequest)(nil), // 16: headscale.v1.MoveMachineRequest
|
||||||
(*GetMachineRouteRequest)(nil), // 17: headscale.v1.GetMachineRouteRequest
|
(*GetRoutesRequest)(nil), // 17: headscale.v1.GetRoutesRequest
|
||||||
(*EnableMachineRoutesRequest)(nil), // 18: headscale.v1.EnableMachineRoutesRequest
|
(*EnableRouteRequest)(nil), // 18: headscale.v1.EnableRouteRequest
|
||||||
(*CreateApiKeyRequest)(nil), // 19: headscale.v1.CreateApiKeyRequest
|
(*DisableRouteRequest)(nil), // 19: headscale.v1.DisableRouteRequest
|
||||||
(*ExpireApiKeyRequest)(nil), // 20: headscale.v1.ExpireApiKeyRequest
|
(*GetMachineRoutesRequest)(nil), // 20: headscale.v1.GetMachineRoutesRequest
|
||||||
(*ListApiKeysRequest)(nil), // 21: headscale.v1.ListApiKeysRequest
|
(*CreateApiKeyRequest)(nil), // 21: headscale.v1.CreateApiKeyRequest
|
||||||
(*GetNamespaceResponse)(nil), // 22: headscale.v1.GetNamespaceResponse
|
(*ExpireApiKeyRequest)(nil), // 22: headscale.v1.ExpireApiKeyRequest
|
||||||
(*CreateNamespaceResponse)(nil), // 23: headscale.v1.CreateNamespaceResponse
|
(*ListApiKeysRequest)(nil), // 23: headscale.v1.ListApiKeysRequest
|
||||||
(*RenameNamespaceResponse)(nil), // 24: headscale.v1.RenameNamespaceResponse
|
(*GetNamespaceResponse)(nil), // 24: headscale.v1.GetNamespaceResponse
|
||||||
(*DeleteNamespaceResponse)(nil), // 25: headscale.v1.DeleteNamespaceResponse
|
(*CreateNamespaceResponse)(nil), // 25: headscale.v1.CreateNamespaceResponse
|
||||||
(*ListNamespacesResponse)(nil), // 26: headscale.v1.ListNamespacesResponse
|
(*RenameNamespaceResponse)(nil), // 26: headscale.v1.RenameNamespaceResponse
|
||||||
(*CreatePreAuthKeyResponse)(nil), // 27: headscale.v1.CreatePreAuthKeyResponse
|
(*DeleteNamespaceResponse)(nil), // 27: headscale.v1.DeleteNamespaceResponse
|
||||||
(*ExpirePreAuthKeyResponse)(nil), // 28: headscale.v1.ExpirePreAuthKeyResponse
|
(*ListNamespacesResponse)(nil), // 28: headscale.v1.ListNamespacesResponse
|
||||||
(*ListPreAuthKeysResponse)(nil), // 29: headscale.v1.ListPreAuthKeysResponse
|
(*CreatePreAuthKeyResponse)(nil), // 29: headscale.v1.CreatePreAuthKeyResponse
|
||||||
(*DebugCreateMachineResponse)(nil), // 30: headscale.v1.DebugCreateMachineResponse
|
(*ExpirePreAuthKeyResponse)(nil), // 30: headscale.v1.ExpirePreAuthKeyResponse
|
||||||
(*GetMachineResponse)(nil), // 31: headscale.v1.GetMachineResponse
|
(*ListPreAuthKeysResponse)(nil), // 31: headscale.v1.ListPreAuthKeysResponse
|
||||||
(*SetTagsResponse)(nil), // 32: headscale.v1.SetTagsResponse
|
(*DebugCreateMachineResponse)(nil), // 32: headscale.v1.DebugCreateMachineResponse
|
||||||
(*RegisterMachineResponse)(nil), // 33: headscale.v1.RegisterMachineResponse
|
(*GetMachineResponse)(nil), // 33: headscale.v1.GetMachineResponse
|
||||||
(*DeleteMachineResponse)(nil), // 34: headscale.v1.DeleteMachineResponse
|
(*SetTagsResponse)(nil), // 34: headscale.v1.SetTagsResponse
|
||||||
(*ExpireMachineResponse)(nil), // 35: headscale.v1.ExpireMachineResponse
|
(*RegisterMachineResponse)(nil), // 35: headscale.v1.RegisterMachineResponse
|
||||||
(*RenameMachineResponse)(nil), // 36: headscale.v1.RenameMachineResponse
|
(*DeleteMachineResponse)(nil), // 36: headscale.v1.DeleteMachineResponse
|
||||||
(*ListMachinesResponse)(nil), // 37: headscale.v1.ListMachinesResponse
|
(*ExpireMachineResponse)(nil), // 37: headscale.v1.ExpireMachineResponse
|
||||||
(*MoveMachineResponse)(nil), // 38: headscale.v1.MoveMachineResponse
|
(*RenameMachineResponse)(nil), // 38: headscale.v1.RenameMachineResponse
|
||||||
(*GetMachineRouteResponse)(nil), // 39: headscale.v1.GetMachineRouteResponse
|
(*ListMachinesResponse)(nil), // 39: headscale.v1.ListMachinesResponse
|
||||||
(*EnableMachineRoutesResponse)(nil), // 40: headscale.v1.EnableMachineRoutesResponse
|
(*MoveMachineResponse)(nil), // 40: headscale.v1.MoveMachineResponse
|
||||||
(*CreateApiKeyResponse)(nil), // 41: headscale.v1.CreateApiKeyResponse
|
(*GetRoutesResponse)(nil), // 41: headscale.v1.GetRoutesResponse
|
||||||
(*ExpireApiKeyResponse)(nil), // 42: headscale.v1.ExpireApiKeyResponse
|
(*EnableRouteResponse)(nil), // 42: headscale.v1.EnableRouteResponse
|
||||||
(*ListApiKeysResponse)(nil), // 43: headscale.v1.ListApiKeysResponse
|
(*DisableRouteResponse)(nil), // 43: headscale.v1.DisableRouteResponse
|
||||||
|
(*GetMachineRoutesResponse)(nil), // 44: headscale.v1.GetMachineRoutesResponse
|
||||||
|
(*CreateApiKeyResponse)(nil), // 45: headscale.v1.CreateApiKeyResponse
|
||||||
|
(*ExpireApiKeyResponse)(nil), // 46: headscale.v1.ExpireApiKeyResponse
|
||||||
|
(*ListApiKeysResponse)(nil), // 47: headscale.v1.ListApiKeysResponse
|
||||||
}
|
}
|
||||||
var file_headscale_v1_headscale_proto_depIdxs = []int32{
|
var file_headscale_v1_headscale_proto_depIdxs = []int32{
|
||||||
0, // 0: headscale.v1.HeadscaleService.GetNamespace:input_type -> headscale.v1.GetNamespaceRequest
|
0, // 0: headscale.v1.HeadscaleService.GetNamespace:input_type -> headscale.v1.GetNamespaceRequest
|
||||||
@@ -285,35 +302,39 @@ var file_headscale_v1_headscale_proto_depIdxs = []int32{
|
|||||||
14, // 14: headscale.v1.HeadscaleService.RenameMachine:input_type -> headscale.v1.RenameMachineRequest
|
14, // 14: headscale.v1.HeadscaleService.RenameMachine:input_type -> headscale.v1.RenameMachineRequest
|
||||||
15, // 15: headscale.v1.HeadscaleService.ListMachines:input_type -> headscale.v1.ListMachinesRequest
|
15, // 15: headscale.v1.HeadscaleService.ListMachines:input_type -> headscale.v1.ListMachinesRequest
|
||||||
16, // 16: headscale.v1.HeadscaleService.MoveMachine:input_type -> headscale.v1.MoveMachineRequest
|
16, // 16: headscale.v1.HeadscaleService.MoveMachine:input_type -> headscale.v1.MoveMachineRequest
|
||||||
17, // 17: headscale.v1.HeadscaleService.GetMachineRoute:input_type -> headscale.v1.GetMachineRouteRequest
|
17, // 17: headscale.v1.HeadscaleService.GetRoutes:input_type -> headscale.v1.GetRoutesRequest
|
||||||
18, // 18: headscale.v1.HeadscaleService.EnableMachineRoutes:input_type -> headscale.v1.EnableMachineRoutesRequest
|
18, // 18: headscale.v1.HeadscaleService.EnableRoute:input_type -> headscale.v1.EnableRouteRequest
|
||||||
19, // 19: headscale.v1.HeadscaleService.CreateApiKey:input_type -> headscale.v1.CreateApiKeyRequest
|
19, // 19: headscale.v1.HeadscaleService.DisableRoute:input_type -> headscale.v1.DisableRouteRequest
|
||||||
20, // 20: headscale.v1.HeadscaleService.ExpireApiKey:input_type -> headscale.v1.ExpireApiKeyRequest
|
20, // 20: headscale.v1.HeadscaleService.GetMachineRoutes:input_type -> headscale.v1.GetMachineRoutesRequest
|
||||||
21, // 21: headscale.v1.HeadscaleService.ListApiKeys:input_type -> headscale.v1.ListApiKeysRequest
|
21, // 21: headscale.v1.HeadscaleService.CreateApiKey:input_type -> headscale.v1.CreateApiKeyRequest
|
||||||
22, // 22: headscale.v1.HeadscaleService.GetNamespace:output_type -> headscale.v1.GetNamespaceResponse
|
22, // 22: headscale.v1.HeadscaleService.ExpireApiKey:input_type -> headscale.v1.ExpireApiKeyRequest
|
||||||
23, // 23: headscale.v1.HeadscaleService.CreateNamespace:output_type -> headscale.v1.CreateNamespaceResponse
|
23, // 23: headscale.v1.HeadscaleService.ListApiKeys:input_type -> headscale.v1.ListApiKeysRequest
|
||||||
24, // 24: headscale.v1.HeadscaleService.RenameNamespace:output_type -> headscale.v1.RenameNamespaceResponse
|
24, // 24: headscale.v1.HeadscaleService.GetNamespace:output_type -> headscale.v1.GetNamespaceResponse
|
||||||
25, // 25: headscale.v1.HeadscaleService.DeleteNamespace:output_type -> headscale.v1.DeleteNamespaceResponse
|
25, // 25: headscale.v1.HeadscaleService.CreateNamespace:output_type -> headscale.v1.CreateNamespaceResponse
|
||||||
26, // 26: headscale.v1.HeadscaleService.ListNamespaces:output_type -> headscale.v1.ListNamespacesResponse
|
26, // 26: headscale.v1.HeadscaleService.RenameNamespace:output_type -> headscale.v1.RenameNamespaceResponse
|
||||||
27, // 27: headscale.v1.HeadscaleService.CreatePreAuthKey:output_type -> headscale.v1.CreatePreAuthKeyResponse
|
27, // 27: headscale.v1.HeadscaleService.DeleteNamespace:output_type -> headscale.v1.DeleteNamespaceResponse
|
||||||
28, // 28: headscale.v1.HeadscaleService.ExpirePreAuthKey:output_type -> headscale.v1.ExpirePreAuthKeyResponse
|
28, // 28: headscale.v1.HeadscaleService.ListNamespaces:output_type -> headscale.v1.ListNamespacesResponse
|
||||||
29, // 29: headscale.v1.HeadscaleService.ListPreAuthKeys:output_type -> headscale.v1.ListPreAuthKeysResponse
|
29, // 29: headscale.v1.HeadscaleService.CreatePreAuthKey:output_type -> headscale.v1.CreatePreAuthKeyResponse
|
||||||
30, // 30: headscale.v1.HeadscaleService.DebugCreateMachine:output_type -> headscale.v1.DebugCreateMachineResponse
|
30, // 30: headscale.v1.HeadscaleService.ExpirePreAuthKey:output_type -> headscale.v1.ExpirePreAuthKeyResponse
|
||||||
31, // 31: headscale.v1.HeadscaleService.GetMachine:output_type -> headscale.v1.GetMachineResponse
|
31, // 31: headscale.v1.HeadscaleService.ListPreAuthKeys:output_type -> headscale.v1.ListPreAuthKeysResponse
|
||||||
32, // 32: headscale.v1.HeadscaleService.SetTags:output_type -> headscale.v1.SetTagsResponse
|
32, // 32: headscale.v1.HeadscaleService.DebugCreateMachine:output_type -> headscale.v1.DebugCreateMachineResponse
|
||||||
33, // 33: headscale.v1.HeadscaleService.RegisterMachine:output_type -> headscale.v1.RegisterMachineResponse
|
33, // 33: headscale.v1.HeadscaleService.GetMachine:output_type -> headscale.v1.GetMachineResponse
|
||||||
34, // 34: headscale.v1.HeadscaleService.DeleteMachine:output_type -> headscale.v1.DeleteMachineResponse
|
34, // 34: headscale.v1.HeadscaleService.SetTags:output_type -> headscale.v1.SetTagsResponse
|
||||||
35, // 35: headscale.v1.HeadscaleService.ExpireMachine:output_type -> headscale.v1.ExpireMachineResponse
|
35, // 35: headscale.v1.HeadscaleService.RegisterMachine:output_type -> headscale.v1.RegisterMachineResponse
|
||||||
36, // 36: headscale.v1.HeadscaleService.RenameMachine:output_type -> headscale.v1.RenameMachineResponse
|
36, // 36: headscale.v1.HeadscaleService.DeleteMachine:output_type -> headscale.v1.DeleteMachineResponse
|
||||||
37, // 37: headscale.v1.HeadscaleService.ListMachines:output_type -> headscale.v1.ListMachinesResponse
|
37, // 37: headscale.v1.HeadscaleService.ExpireMachine:output_type -> headscale.v1.ExpireMachineResponse
|
||||||
38, // 38: headscale.v1.HeadscaleService.MoveMachine:output_type -> headscale.v1.MoveMachineResponse
|
38, // 38: headscale.v1.HeadscaleService.RenameMachine:output_type -> headscale.v1.RenameMachineResponse
|
||||||
39, // 39: headscale.v1.HeadscaleService.GetMachineRoute:output_type -> headscale.v1.GetMachineRouteResponse
|
39, // 39: headscale.v1.HeadscaleService.ListMachines:output_type -> headscale.v1.ListMachinesResponse
|
||||||
40, // 40: headscale.v1.HeadscaleService.EnableMachineRoutes:output_type -> headscale.v1.EnableMachineRoutesResponse
|
40, // 40: headscale.v1.HeadscaleService.MoveMachine:output_type -> headscale.v1.MoveMachineResponse
|
||||||
41, // 41: headscale.v1.HeadscaleService.CreateApiKey:output_type -> headscale.v1.CreateApiKeyResponse
|
41, // 41: headscale.v1.HeadscaleService.GetRoutes:output_type -> headscale.v1.GetRoutesResponse
|
||||||
42, // 42: headscale.v1.HeadscaleService.ExpireApiKey:output_type -> headscale.v1.ExpireApiKeyResponse
|
42, // 42: headscale.v1.HeadscaleService.EnableRoute:output_type -> headscale.v1.EnableRouteResponse
|
||||||
43, // 43: headscale.v1.HeadscaleService.ListApiKeys:output_type -> headscale.v1.ListApiKeysResponse
|
43, // 43: headscale.v1.HeadscaleService.DisableRoute:output_type -> headscale.v1.DisableRouteResponse
|
||||||
22, // [22:44] is the sub-list for method output_type
|
44, // 44: headscale.v1.HeadscaleService.GetMachineRoutes:output_type -> headscale.v1.GetMachineRoutesResponse
|
||||||
0, // [0:22] is the sub-list for method input_type
|
45, // 45: headscale.v1.HeadscaleService.CreateApiKey:output_type -> headscale.v1.CreateApiKeyResponse
|
||||||
|
46, // 46: headscale.v1.HeadscaleService.ExpireApiKey:output_type -> headscale.v1.ExpireApiKeyResponse
|
||||||
|
47, // 47: headscale.v1.HeadscaleService.ListApiKeys:output_type -> headscale.v1.ListApiKeysResponse
|
||||||
|
24, // [24:48] is the sub-list for method output_type
|
||||||
|
0, // [0:24] is the sub-list for method input_type
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
0, // [0:0] is the sub-list for field type_name
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -43,8 +43,10 @@ type HeadscaleServiceClient interface {
|
|||||||
ListMachines(ctx context.Context, in *ListMachinesRequest, opts ...grpc.CallOption) (*ListMachinesResponse, error)
|
ListMachines(ctx context.Context, in *ListMachinesRequest, opts ...grpc.CallOption) (*ListMachinesResponse, error)
|
||||||
MoveMachine(ctx context.Context, in *MoveMachineRequest, opts ...grpc.CallOption) (*MoveMachineResponse, error)
|
MoveMachine(ctx context.Context, in *MoveMachineRequest, opts ...grpc.CallOption) (*MoveMachineResponse, error)
|
||||||
// --- Route start ---
|
// --- Route start ---
|
||||||
GetMachineRoute(ctx context.Context, in *GetMachineRouteRequest, opts ...grpc.CallOption) (*GetMachineRouteResponse, error)
|
GetRoutes(ctx context.Context, in *GetRoutesRequest, opts ...grpc.CallOption) (*GetRoutesResponse, error)
|
||||||
EnableMachineRoutes(ctx context.Context, in *EnableMachineRoutesRequest, opts ...grpc.CallOption) (*EnableMachineRoutesResponse, error)
|
EnableRoute(ctx context.Context, in *EnableRouteRequest, opts ...grpc.CallOption) (*EnableRouteResponse, error)
|
||||||
|
DisableRoute(ctx context.Context, in *DisableRouteRequest, opts ...grpc.CallOption) (*DisableRouteResponse, error)
|
||||||
|
GetMachineRoutes(ctx context.Context, in *GetMachineRoutesRequest, opts ...grpc.CallOption) (*GetMachineRoutesResponse, error)
|
||||||
// --- ApiKeys start ---
|
// --- ApiKeys start ---
|
||||||
CreateApiKey(ctx context.Context, in *CreateApiKeyRequest, opts ...grpc.CallOption) (*CreateApiKeyResponse, error)
|
CreateApiKey(ctx context.Context, in *CreateApiKeyRequest, opts ...grpc.CallOption) (*CreateApiKeyResponse, error)
|
||||||
ExpireApiKey(ctx context.Context, in *ExpireApiKeyRequest, opts ...grpc.CallOption) (*ExpireApiKeyResponse, error)
|
ExpireApiKey(ctx context.Context, in *ExpireApiKeyRequest, opts ...grpc.CallOption) (*ExpireApiKeyResponse, error)
|
||||||
@@ -212,18 +214,36 @@ func (c *headscaleServiceClient) MoveMachine(ctx context.Context, in *MoveMachin
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *headscaleServiceClient) GetMachineRoute(ctx context.Context, in *GetMachineRouteRequest, opts ...grpc.CallOption) (*GetMachineRouteResponse, error) {
|
func (c *headscaleServiceClient) GetRoutes(ctx context.Context, in *GetRoutesRequest, opts ...grpc.CallOption) (*GetRoutesResponse, error) {
|
||||||
out := new(GetMachineRouteResponse)
|
out := new(GetRoutesResponse)
|
||||||
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/GetMachineRoute", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/GetRoutes", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *headscaleServiceClient) EnableMachineRoutes(ctx context.Context, in *EnableMachineRoutesRequest, opts ...grpc.CallOption) (*EnableMachineRoutesResponse, error) {
|
func (c *headscaleServiceClient) EnableRoute(ctx context.Context, in *EnableRouteRequest, opts ...grpc.CallOption) (*EnableRouteResponse, error) {
|
||||||
out := new(EnableMachineRoutesResponse)
|
out := new(EnableRouteResponse)
|
||||||
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/EnableMachineRoutes", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/EnableRoute", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *headscaleServiceClient) DisableRoute(ctx context.Context, in *DisableRouteRequest, opts ...grpc.CallOption) (*DisableRouteResponse, error) {
|
||||||
|
out := new(DisableRouteResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/DisableRoute", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *headscaleServiceClient) GetMachineRoutes(ctx context.Context, in *GetMachineRoutesRequest, opts ...grpc.CallOption) (*GetMachineRoutesResponse, error) {
|
||||||
|
out := new(GetMachineRoutesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/headscale.v1.HeadscaleService/GetMachineRoutes", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -282,8 +302,10 @@ type HeadscaleServiceServer interface {
|
|||||||
ListMachines(context.Context, *ListMachinesRequest) (*ListMachinesResponse, error)
|
ListMachines(context.Context, *ListMachinesRequest) (*ListMachinesResponse, error)
|
||||||
MoveMachine(context.Context, *MoveMachineRequest) (*MoveMachineResponse, error)
|
MoveMachine(context.Context, *MoveMachineRequest) (*MoveMachineResponse, error)
|
||||||
// --- Route start ---
|
// --- Route start ---
|
||||||
GetMachineRoute(context.Context, *GetMachineRouteRequest) (*GetMachineRouteResponse, error)
|
GetRoutes(context.Context, *GetRoutesRequest) (*GetRoutesResponse, error)
|
||||||
EnableMachineRoutes(context.Context, *EnableMachineRoutesRequest) (*EnableMachineRoutesResponse, error)
|
EnableRoute(context.Context, *EnableRouteRequest) (*EnableRouteResponse, error)
|
||||||
|
DisableRoute(context.Context, *DisableRouteRequest) (*DisableRouteResponse, error)
|
||||||
|
GetMachineRoutes(context.Context, *GetMachineRoutesRequest) (*GetMachineRoutesResponse, error)
|
||||||
// --- ApiKeys start ---
|
// --- ApiKeys start ---
|
||||||
CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error)
|
CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error)
|
||||||
ExpireApiKey(context.Context, *ExpireApiKeyRequest) (*ExpireApiKeyResponse, error)
|
ExpireApiKey(context.Context, *ExpireApiKeyRequest) (*ExpireApiKeyResponse, error)
|
||||||
@@ -346,11 +368,17 @@ func (UnimplementedHeadscaleServiceServer) ListMachines(context.Context, *ListMa
|
|||||||
func (UnimplementedHeadscaleServiceServer) MoveMachine(context.Context, *MoveMachineRequest) (*MoveMachineResponse, error) {
|
func (UnimplementedHeadscaleServiceServer) MoveMachine(context.Context, *MoveMachineRequest) (*MoveMachineResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method MoveMachine not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method MoveMachine not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHeadscaleServiceServer) GetMachineRoute(context.Context, *GetMachineRouteRequest) (*GetMachineRouteResponse, error) {
|
func (UnimplementedHeadscaleServiceServer) GetRoutes(context.Context, *GetRoutesRequest) (*GetRoutesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetMachineRoute not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetRoutes not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHeadscaleServiceServer) EnableMachineRoutes(context.Context, *EnableMachineRoutesRequest) (*EnableMachineRoutesResponse, error) {
|
func (UnimplementedHeadscaleServiceServer) EnableRoute(context.Context, *EnableRouteRequest) (*EnableRouteResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method EnableMachineRoutes not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method EnableRoute not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedHeadscaleServiceServer) DisableRoute(context.Context, *DisableRouteRequest) (*DisableRouteResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method DisableRoute not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedHeadscaleServiceServer) GetMachineRoutes(context.Context, *GetMachineRoutesRequest) (*GetMachineRoutesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetMachineRoutes not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHeadscaleServiceServer) CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error) {
|
func (UnimplementedHeadscaleServiceServer) CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateApiKey not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateApiKey not implemented")
|
||||||
@@ -680,38 +708,74 @@ func _HeadscaleService_MoveMachine_Handler(srv interface{}, ctx context.Context,
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _HeadscaleService_GetMachineRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _HeadscaleService_GetRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetMachineRouteRequest)
|
in := new(GetRoutesRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(HeadscaleServiceServer).GetMachineRoute(ctx, in)
|
return srv.(HeadscaleServiceServer).GetRoutes(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/headscale.v1.HeadscaleService/GetMachineRoute",
|
FullMethod: "/headscale.v1.HeadscaleService/GetRoutes",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(HeadscaleServiceServer).GetMachineRoute(ctx, req.(*GetMachineRouteRequest))
|
return srv.(HeadscaleServiceServer).GetRoutes(ctx, req.(*GetRoutesRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _HeadscaleService_EnableMachineRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _HeadscaleService_EnableRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(EnableMachineRoutesRequest)
|
in := new(EnableRouteRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(HeadscaleServiceServer).EnableMachineRoutes(ctx, in)
|
return srv.(HeadscaleServiceServer).EnableRoute(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/headscale.v1.HeadscaleService/EnableMachineRoutes",
|
FullMethod: "/headscale.v1.HeadscaleService/EnableRoute",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(HeadscaleServiceServer).EnableMachineRoutes(ctx, req.(*EnableMachineRoutesRequest))
|
return srv.(HeadscaleServiceServer).EnableRoute(ctx, req.(*EnableRouteRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _HeadscaleService_DisableRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DisableRouteRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(HeadscaleServiceServer).DisableRoute(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/headscale.v1.HeadscaleService/DisableRoute",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(HeadscaleServiceServer).DisableRoute(ctx, req.(*DisableRouteRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _HeadscaleService_GetMachineRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetMachineRoutesRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(HeadscaleServiceServer).GetMachineRoutes(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/headscale.v1.HeadscaleService/GetMachineRoutes",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(HeadscaleServiceServer).GetMachineRoutes(ctx, req.(*GetMachineRoutesRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
@@ -846,12 +910,20 @@ var HeadscaleService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
Handler: _HeadscaleService_MoveMachine_Handler,
|
Handler: _HeadscaleService_MoveMachine_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetMachineRoute",
|
MethodName: "GetRoutes",
|
||||||
Handler: _HeadscaleService_GetMachineRoute_Handler,
|
Handler: _HeadscaleService_GetRoutes_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "EnableMachineRoutes",
|
MethodName: "EnableRoute",
|
||||||
Handler: _HeadscaleService_EnableMachineRoutes_Handler,
|
Handler: _HeadscaleService_EnableRoute_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "DisableRoute",
|
||||||
|
Handler: _HeadscaleService_DisableRoute_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetMachineRoutes",
|
||||||
|
Handler: _HeadscaleService_GetMachineRoutes_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "CreateApiKey",
|
MethodName: "CreateApiKey",
|
||||||
|
@@ -9,6 +9,7 @@ package v1
|
|||||||
import (
|
import (
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
)
|
)
|
||||||
@@ -20,17 +21,24 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Routes struct {
|
type Route struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
AdvertisedRoutes []string `protobuf:"bytes,1,rep,name=advertised_routes,json=advertisedRoutes,proto3" json:"advertised_routes,omitempty"`
|
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
EnabledRoutes []string `protobuf:"bytes,2,rep,name=enabled_routes,json=enabledRoutes,proto3" json:"enabled_routes,omitempty"`
|
Machine *Machine `protobuf:"bytes,2,opt,name=machine,proto3" json:"machine,omitempty"`
|
||||||
|
Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
|
||||||
|
Advertised bool `protobuf:"varint,4,opt,name=advertised,proto3" json:"advertised,omitempty"`
|
||||||
|
Enabled bool `protobuf:"varint,5,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||||
|
IsPrimary bool `protobuf:"varint,6,opt,name=is_primary,json=isPrimary,proto3" json:"is_primary,omitempty"`
|
||||||
|
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||||
|
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||||
|
DeletedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Routes) Reset() {
|
func (x *Route) Reset() {
|
||||||
*x = Routes{}
|
*x = Route{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[0]
|
mi := &file_headscale_v1_routes_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -38,13 +46,13 @@ func (x *Routes) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Routes) String() string {
|
func (x *Route) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Routes) ProtoMessage() {}
|
func (*Route) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *Routes) ProtoReflect() protoreflect.Message {
|
func (x *Route) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[0]
|
mi := &file_headscale_v1_routes_proto_msgTypes[0]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -56,35 +64,82 @@ func (x *Routes) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use Routes.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Route.ProtoReflect.Descriptor instead.
|
||||||
func (*Routes) Descriptor() ([]byte, []int) {
|
func (*Route) Descriptor() ([]byte, []int) {
|
||||||
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{0}
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Routes) GetAdvertisedRoutes() []string {
|
func (x *Route) GetId() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.AdvertisedRoutes
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetMachine() *Machine {
|
||||||
|
if x != nil {
|
||||||
|
return x.Machine
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Routes) GetEnabledRoutes() []string {
|
func (x *Route) GetPrefix() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.EnabledRoutes
|
return x.Prefix
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetAdvertised() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Advertised
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetEnabled() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Enabled
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetIsPrimary() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsPrimary
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetCreatedAt() *timestamppb.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetMachineRouteRequest struct {
|
func (x *Route) GetUpdatedAt() *timestamppb.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.UpdatedAt
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Route) GetDeletedAt() *timestamppb.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.DeletedAt
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetRoutesRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
MachineId uint64 `protobuf:"varint,1,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteRequest) Reset() {
|
func (x *GetRoutesRequest) Reset() {
|
||||||
*x = GetMachineRouteRequest{}
|
*x = GetRoutesRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[1]
|
mi := &file_headscale_v1_routes_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -92,13 +147,13 @@ func (x *GetMachineRouteRequest) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteRequest) String() string {
|
func (x *GetRoutesRequest) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*GetMachineRouteRequest) ProtoMessage() {}
|
func (*GetRoutesRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetMachineRouteRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetRoutesRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[1]
|
mi := &file_headscale_v1_routes_proto_msgTypes[1]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -110,28 +165,21 @@ func (x *GetMachineRouteRequest) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use GetMachineRouteRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetRoutesRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetMachineRouteRequest) Descriptor() ([]byte, []int) {
|
func (*GetRoutesRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{1}
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteRequest) GetMachineId() uint64 {
|
type GetRoutesResponse struct {
|
||||||
if x != nil {
|
|
||||||
return x.MachineId
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetMachineRouteResponse struct {
|
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Routes *Routes `protobuf:"bytes,1,opt,name=routes,proto3" json:"routes,omitempty"`
|
Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteResponse) Reset() {
|
func (x *GetRoutesResponse) Reset() {
|
||||||
*x = GetMachineRouteResponse{}
|
*x = GetRoutesResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[2]
|
mi := &file_headscale_v1_routes_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -139,13 +187,13 @@ func (x *GetMachineRouteResponse) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteResponse) String() string {
|
func (x *GetRoutesResponse) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*GetMachineRouteResponse) ProtoMessage() {}
|
func (*GetRoutesResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetMachineRouteResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetRoutesResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[2]
|
mi := &file_headscale_v1_routes_proto_msgTypes[2]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -157,29 +205,28 @@ func (x *GetMachineRouteResponse) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use GetMachineRouteResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetRoutesResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetMachineRouteResponse) Descriptor() ([]byte, []int) {
|
func (*GetRoutesResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{2}
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMachineRouteResponse) GetRoutes() *Routes {
|
func (x *GetRoutesResponse) GetRoutes() []*Route {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Routes
|
return x.Routes
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnableMachineRoutesRequest struct {
|
type EnableRouteRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
MachineId uint64 `protobuf:"varint,1,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"`
|
RouteId uint64 `protobuf:"varint,1,opt,name=route_id,json=routeId,proto3" json:"route_id,omitempty"`
|
||||||
Routes []string `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesRequest) Reset() {
|
func (x *EnableRouteRequest) Reset() {
|
||||||
*x = EnableMachineRoutesRequest{}
|
*x = EnableRouteRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[3]
|
mi := &file_headscale_v1_routes_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -187,13 +234,13 @@ func (x *EnableMachineRoutesRequest) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesRequest) String() string {
|
func (x *EnableRouteRequest) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*EnableMachineRoutesRequest) ProtoMessage() {}
|
func (*EnableRouteRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesRequest) ProtoReflect() protoreflect.Message {
|
func (x *EnableRouteRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[3]
|
mi := &file_headscale_v1_routes_proto_msgTypes[3]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -205,35 +252,26 @@ func (x *EnableMachineRoutesRequest) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use EnableMachineRoutesRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use EnableRouteRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*EnableMachineRoutesRequest) Descriptor() ([]byte, []int) {
|
func (*EnableRouteRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{3}
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesRequest) GetMachineId() uint64 {
|
func (x *EnableRouteRequest) GetRouteId() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.MachineId
|
return x.RouteId
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesRequest) GetRoutes() []string {
|
type EnableRouteResponse struct {
|
||||||
if x != nil {
|
|
||||||
return x.Routes
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type EnableMachineRoutesResponse struct {
|
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Routes *Routes `protobuf:"bytes,1,opt,name=routes,proto3" json:"routes,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesResponse) Reset() {
|
func (x *EnableRouteResponse) Reset() {
|
||||||
*x = EnableMachineRoutesResponse{}
|
*x = EnableRouteResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[4]
|
mi := &file_headscale_v1_routes_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -241,13 +279,13 @@ func (x *EnableMachineRoutesResponse) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesResponse) String() string {
|
func (x *EnableRouteResponse) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*EnableMachineRoutesResponse) ProtoMessage() {}
|
func (*EnableRouteResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesResponse) ProtoReflect() protoreflect.Message {
|
func (x *EnableRouteResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_headscale_v1_routes_proto_msgTypes[4]
|
mi := &file_headscale_v1_routes_proto_msgTypes[4]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@@ -259,12 +297,184 @@ func (x *EnableMachineRoutesResponse) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use EnableMachineRoutesResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use EnableRouteResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*EnableMachineRoutesResponse) Descriptor() ([]byte, []int) {
|
func (*EnableRouteResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{4}
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnableMachineRoutesResponse) GetRoutes() *Routes {
|
type DisableRouteRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RouteId uint64 `protobuf:"varint,1,opt,name=route_id,json=routeId,proto3" json:"route_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DisableRouteRequest) Reset() {
|
||||||
|
*x = DisableRouteRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DisableRouteRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DisableRouteRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DisableRouteRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DisableRouteRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DisableRouteRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DisableRouteRequest) GetRouteId() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RouteId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type DisableRouteResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DisableRouteResponse) Reset() {
|
||||||
|
*x = DisableRouteResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DisableRouteResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DisableRouteResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DisableRouteResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[6]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DisableRouteResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DisableRouteResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMachineRoutesRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
MachineId uint64 `protobuf:"varint,1,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesRequest) Reset() {
|
||||||
|
*x = GetMachineRoutesRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetMachineRoutesRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[7]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetMachineRoutesRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetMachineRoutesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesRequest) GetMachineId() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MachineId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMachineRoutesResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesResponse) Reset() {
|
||||||
|
*x = GetMachineRoutesResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetMachineRoutesResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_headscale_v1_routes_proto_msgTypes[8]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetMachineRoutesResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetMachineRoutesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_headscale_v1_routes_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMachineRoutesResponse) GetRoutes() []*Route {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Routes
|
return x.Routes
|
||||||
}
|
}
|
||||||
@@ -276,34 +486,60 @@ var File_headscale_v1_routes_proto protoreflect.FileDescriptor
|
|||||||
var file_headscale_v1_routes_proto_rawDesc = []byte{
|
var file_headscale_v1_routes_proto_rawDesc = []byte{
|
||||||
0x0a, 0x19, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72,
|
0x0a, 0x19, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72,
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x68, 0x65, 0x61,
|
0x6f, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x68, 0x65, 0x61,
|
||||||
0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x22, 0x5c, 0x0a, 0x06, 0x52, 0x6f, 0x75,
|
0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||||
0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x64, 0x76, 0x65, 0x72, 0x74, 0x69, 0x73, 0x65,
|
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73,
|
||||||
0x64, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10,
|
0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x68, 0x65, 0x61, 0x64,
|
||||||
0x61, 0x64, 0x76, 0x65, 0x72, 0x74, 0x69, 0x73, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73,
|
0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
|
||||||
0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x74,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xea, 0x02, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
||||||
0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64,
|
||||||
0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0x37, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61,
|
0x12, 0x2f, 0x0a, 0x07, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x0b, 0x32, 0x15, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31,
|
||||||
0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18,
|
0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x07, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x64,
|
0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x22, 0x47, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f,
|
0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x76,
|
||||||
0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x72,
|
0x65, 0x72, 0x74, 0x69, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61,
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x68, 0x65,
|
0x64, 0x76, 0x65, 0x72, 0x74, 0x69, 0x73, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61,
|
||||||
0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
0x62, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62,
|
||||||
0x73, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0x53, 0x0a, 0x1a, 0x45, 0x6e, 0x61,
|
0x6c, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72,
|
||||||
0x62, 0x6c, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73,
|
0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x50, 0x72, 0x69, 0x6d, 0x61,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x63, 0x68, 0x69,
|
0x72, 0x79, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
|
||||||
0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x61, 0x63,
|
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||||
0x68, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
|
||||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0x4b,
|
0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a,
|
||||||
0x0a, 0x1b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52,
|
0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a,
|
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
|
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75,
|
||||||
0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75,
|
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x65,
|
||||||
0x74, 0x65, 0x73, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x42, 0x29, 0x5a, 0x27, 0x67,
|
0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
|
||||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x66, 0x6f,
|
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
|
||||||
0x6e, 0x74, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x67, 0x65, 0x6e,
|
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||||
0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x64, 0x41, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73,
|
||||||
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x40, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x52, 0x6f,
|
||||||
|
0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06,
|
||||||
|
0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68,
|
||||||
|
0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x74,
|
||||||
|
0x65, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x12, 0x45, 0x6e, 0x61,
|
||||||
|
0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||||
|
0x19, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x04, 0x52, 0x07, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x45, 0x6e,
|
||||||
|
0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
|
0x65, 0x22, 0x30, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x75, 0x74,
|
||||||
|
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x74,
|
||||||
|
0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x72, 0x6f, 0x75, 0x74,
|
||||||
|
0x65, 0x49, 0x64, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f,
|
||||||
|
0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x0a, 0x17, 0x47,
|
||||||
|
0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e,
|
||||||
|
0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x61, 0x63, 0x68,
|
||||||
|
0x69, 0x6e, 0x65, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68,
|
||||||
|
0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
|
0x65, 0x12, 0x2b, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||||
|
0x0b, 0x32, 0x13, 0x2e, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31,
|
||||||
|
0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x42, 0x29,
|
||||||
|
0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61,
|
||||||
|
0x6e, 0x66, 0x6f, 0x6e, 0x74, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f,
|
||||||
|
0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -318,22 +554,32 @@ func file_headscale_v1_routes_proto_rawDescGZIP() []byte {
|
|||||||
return file_headscale_v1_routes_proto_rawDescData
|
return file_headscale_v1_routes_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_headscale_v1_routes_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
var file_headscale_v1_routes_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||||
var file_headscale_v1_routes_proto_goTypes = []interface{}{
|
var file_headscale_v1_routes_proto_goTypes = []interface{}{
|
||||||
(*Routes)(nil), // 0: headscale.v1.Routes
|
(*Route)(nil), // 0: headscale.v1.Route
|
||||||
(*GetMachineRouteRequest)(nil), // 1: headscale.v1.GetMachineRouteRequest
|
(*GetRoutesRequest)(nil), // 1: headscale.v1.GetRoutesRequest
|
||||||
(*GetMachineRouteResponse)(nil), // 2: headscale.v1.GetMachineRouteResponse
|
(*GetRoutesResponse)(nil), // 2: headscale.v1.GetRoutesResponse
|
||||||
(*EnableMachineRoutesRequest)(nil), // 3: headscale.v1.EnableMachineRoutesRequest
|
(*EnableRouteRequest)(nil), // 3: headscale.v1.EnableRouteRequest
|
||||||
(*EnableMachineRoutesResponse)(nil), // 4: headscale.v1.EnableMachineRoutesResponse
|
(*EnableRouteResponse)(nil), // 4: headscale.v1.EnableRouteResponse
|
||||||
|
(*DisableRouteRequest)(nil), // 5: headscale.v1.DisableRouteRequest
|
||||||
|
(*DisableRouteResponse)(nil), // 6: headscale.v1.DisableRouteResponse
|
||||||
|
(*GetMachineRoutesRequest)(nil), // 7: headscale.v1.GetMachineRoutesRequest
|
||||||
|
(*GetMachineRoutesResponse)(nil), // 8: headscale.v1.GetMachineRoutesResponse
|
||||||
|
(*Machine)(nil), // 9: headscale.v1.Machine
|
||||||
|
(*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp
|
||||||
}
|
}
|
||||||
var file_headscale_v1_routes_proto_depIdxs = []int32{
|
var file_headscale_v1_routes_proto_depIdxs = []int32{
|
||||||
0, // 0: headscale.v1.GetMachineRouteResponse.routes:type_name -> headscale.v1.Routes
|
9, // 0: headscale.v1.Route.machine:type_name -> headscale.v1.Machine
|
||||||
0, // 1: headscale.v1.EnableMachineRoutesResponse.routes:type_name -> headscale.v1.Routes
|
10, // 1: headscale.v1.Route.created_at:type_name -> google.protobuf.Timestamp
|
||||||
2, // [2:2] is the sub-list for method output_type
|
10, // 2: headscale.v1.Route.updated_at:type_name -> google.protobuf.Timestamp
|
||||||
2, // [2:2] is the sub-list for method input_type
|
10, // 3: headscale.v1.Route.deleted_at:type_name -> google.protobuf.Timestamp
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
0, // 4: headscale.v1.GetRoutesResponse.routes:type_name -> headscale.v1.Route
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
0, // 5: headscale.v1.GetMachineRoutesResponse.routes:type_name -> headscale.v1.Route
|
||||||
0, // [0:2] is the sub-list for field type_name
|
6, // [6:6] is the sub-list for method output_type
|
||||||
|
6, // [6:6] is the sub-list for method input_type
|
||||||
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
|
6, // [6:6] is the sub-list for extension extendee
|
||||||
|
0, // [0:6] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_headscale_v1_routes_proto_init() }
|
func init() { file_headscale_v1_routes_proto_init() }
|
||||||
@@ -341,9 +587,10 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
if File_headscale_v1_routes_proto != nil {
|
if File_headscale_v1_routes_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
file_headscale_v1_machine_proto_init()
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_headscale_v1_routes_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_headscale_v1_routes_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*Routes); i {
|
switch v := v.(*Route); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -355,7 +602,7 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_headscale_v1_routes_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
file_headscale_v1_routes_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*GetMachineRouteRequest); i {
|
switch v := v.(*GetRoutesRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -367,7 +614,7 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_headscale_v1_routes_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
file_headscale_v1_routes_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*GetMachineRouteResponse); i {
|
switch v := v.(*GetRoutesResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -379,7 +626,7 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_headscale_v1_routes_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
file_headscale_v1_routes_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*EnableMachineRoutesRequest); i {
|
switch v := v.(*EnableRouteRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -391,7 +638,55 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_headscale_v1_routes_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
file_headscale_v1_routes_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*EnableMachineRoutesResponse); i {
|
switch v := v.(*EnableRouteResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_headscale_v1_routes_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DisableRouteRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_headscale_v1_routes_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DisableRouteResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_headscale_v1_routes_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetMachineRoutesRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_headscale_v1_routes_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetMachineRoutesResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -409,7 +704,7 @@ func file_headscale_v1_routes_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_headscale_v1_routes_proto_rawDesc,
|
RawDescriptor: file_headscale_v1_routes_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 5,
|
NumMessages: 9,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@@ -367,13 +367,12 @@
|
|||||||
},
|
},
|
||||||
"/api/v1/machine/{machineId}/routes": {
|
"/api/v1/machine/{machineId}/routes": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "--- Route start ---",
|
"operationId": "HeadscaleService_GetMachineRoutes",
|
||||||
"operationId": "HeadscaleService_GetMachineRoute",
|
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "A successful response.",
|
"description": "A successful response.",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/v1GetMachineRouteResponse"
|
"$ref": "#/definitions/v1GetMachineRoutesResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
@@ -395,45 +394,6 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"HeadscaleService"
|
"HeadscaleService"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"post": {
|
|
||||||
"operationId": "HeadscaleService_EnableMachineRoutes",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A successful response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/v1EnableMachineRoutesResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"description": "An unexpected error response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/rpcStatus"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "machineId",
|
|
||||||
"in": "path",
|
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
|
||||||
"format": "uint64"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "routes",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"collectionFormat": "multi"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"HeadscaleService"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v1/machine/{machineId}/tags": {
|
"/api/v1/machine/{machineId}/tags": {
|
||||||
@@ -722,6 +682,91 @@
|
|||||||
"HeadscaleService"
|
"HeadscaleService"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/routes": {
|
||||||
|
"get": {
|
||||||
|
"summary": "--- Route start ---",
|
||||||
|
"operationId": "HeadscaleService_GetRoutes",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1GetRoutesResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"HeadscaleService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/routes/{routeId}/disable": {
|
||||||
|
"post": {
|
||||||
|
"operationId": "HeadscaleService_DisableRoute",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1DisableRouteResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "routeId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "uint64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"HeadscaleService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/routes/{routeId}/enable": {
|
||||||
|
"post": {
|
||||||
|
"operationId": "HeadscaleService_EnableRoute",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1EnableRouteResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "routeId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "uint64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"HeadscaleService"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
@@ -875,13 +920,11 @@
|
|||||||
"v1DeleteNamespaceResponse": {
|
"v1DeleteNamespaceResponse": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"v1EnableMachineRoutesResponse": {
|
"v1DisableRouteResponse": {
|
||||||
"type": "object",
|
"type": "object"
|
||||||
"properties": {
|
},
|
||||||
"routes": {
|
"v1EnableRouteResponse": {
|
||||||
"$ref": "#/definitions/v1Routes"
|
"type": "object"
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"v1ExpireApiKeyRequest": {
|
"v1ExpireApiKeyRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -924,11 +967,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"v1GetMachineRouteResponse": {
|
"v1GetMachineRoutesResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"routes": {
|
"routes": {
|
||||||
"$ref": "#/definitions/v1Routes"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/v1Route"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -940,6 +986,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"v1GetRoutesResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"routes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/v1Route"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"v1ListApiKeysResponse": {
|
"v1ListApiKeysResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1151,20 +1208,39 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"v1Routes": {
|
"v1Route": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"advertisedRoutes": {
|
"id": {
|
||||||
"type": "array",
|
"type": "string",
|
||||||
"items": {
|
"format": "uint64"
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"enabledRoutes": {
|
"machine": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/v1Machine"
|
||||||
"items": {
|
},
|
||||||
"type": "string"
|
"prefix": {
|
||||||
}
|
"type": "string"
|
||||||
|
},
|
||||||
|
"advertised": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"isPrimary": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"updatedAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"deletedAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
49
grpcv1.go
49
grpcv1.go
@@ -364,36 +364,60 @@ func (api headscaleV1APIServer) MoveMachine(
|
|||||||
return &v1.MoveMachineResponse{Machine: machine.toProto()}, nil
|
return &v1.MoveMachineResponse{Machine: machine.toProto()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api headscaleV1APIServer) GetMachineRoute(
|
func (api headscaleV1APIServer) GetRoutes(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *v1.GetMachineRouteRequest,
|
request *v1.GetRoutesRequest,
|
||||||
) (*v1.GetMachineRouteResponse, error) {
|
) (*v1.GetRoutesResponse, error) {
|
||||||
machine, err := api.h.GetMachineByID(request.GetMachineId())
|
routes, err := api.h.GetRoutes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &v1.GetMachineRouteResponse{
|
return &v1.GetRoutesResponse{
|
||||||
Routes: machine.RoutesToProto(),
|
Routes: Routes(routes).toProto(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api headscaleV1APIServer) EnableMachineRoutes(
|
func (api headscaleV1APIServer) EnableRoute(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *v1.EnableMachineRoutesRequest,
|
request *v1.EnableRouteRequest,
|
||||||
) (*v1.EnableMachineRoutesResponse, error) {
|
) (*v1.EnableRouteResponse, error) {
|
||||||
|
err := api.h.EnableRoute(request.GetRouteId())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &v1.EnableRouteResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (api headscaleV1APIServer) DisableRoute(
|
||||||
|
ctx context.Context,
|
||||||
|
request *v1.DisableRouteRequest,
|
||||||
|
) (*v1.DisableRouteResponse, error) {
|
||||||
|
err := api.h.DisableRoute(request.GetRouteId())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &v1.DisableRouteResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (api headscaleV1APIServer) GetMachineRoutes(
|
||||||
|
ctx context.Context,
|
||||||
|
request *v1.GetMachineRoutesRequest,
|
||||||
|
) (*v1.GetMachineRoutesResponse, error) {
|
||||||
machine, err := api.h.GetMachineByID(request.GetMachineId())
|
machine, err := api.h.GetMachineByID(request.GetMachineId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = api.h.EnableRoutes(machine, request.GetRoutes()...)
|
routes, err := api.h.GetMachineRoutes(machine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &v1.EnableMachineRoutesResponse{
|
return &v1.GetMachineRoutesResponse{
|
||||||
Routes: machine.RoutesToProto(),
|
Routes: Routes(routes).toProto(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,6 +521,7 @@ func (api headscaleV1APIServer) DebugCreateMachine(
|
|||||||
|
|
||||||
HostInfo: HostInfo(hostinfo),
|
HostInfo: HostInfo(hostinfo),
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeKey := key.NodePublic{}
|
nodeKey := key.NodePublic{}
|
||||||
err = nodeKey.UnmarshalText([]byte(request.GetKey()))
|
err = nodeKey.UnmarshalText([]byte(request.GetKey()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -2,7 +2,9 @@ package integration
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -389,3 +391,144 @@ func TestPreAuthKeyCommandReusableEphemeral(t *testing.T) {
|
|||||||
err = scenario.Shutdown()
|
err = scenario.Shutdown()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEnablingRoutes(t *testing.T) {
|
||||||
|
IntegrationSkip(t)
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
namespace := "enable-routing"
|
||||||
|
|
||||||
|
scenario, err := NewScenario()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
spec := map[string]int{
|
||||||
|
namespace: 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("clienableroute"))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
allClients, err := scenario.ListTailscaleClients()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to get clients: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = scenario.WaitForTailscaleSync()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed wait for tailscale clients to be in sync: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
headscale, err := scenario.Headscale()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// advertise routes using the up command
|
||||||
|
for i, client := range allClients {
|
||||||
|
routeStr := fmt.Sprintf("10.0.%d.0/24", i)
|
||||||
|
hostname, _ := client.FQDN()
|
||||||
|
_, _, err = client.Execute([]string{
|
||||||
|
"tailscale",
|
||||||
|
"up",
|
||||||
|
fmt.Sprintf("--advertise-routes=%s", routeStr),
|
||||||
|
"-login-server", headscale.GetEndpoint(),
|
||||||
|
"--hostname", hostname,
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = scenario.WaitForTailscaleSync()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed wait for tailscale clients to be in sync: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var routes []*v1.Route
|
||||||
|
err = executeAndUnmarshal(
|
||||||
|
headscale,
|
||||||
|
[]string{
|
||||||
|
"headscale",
|
||||||
|
"routes",
|
||||||
|
"list",
|
||||||
|
"--output",
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
&routes,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Len(t, routes, 3)
|
||||||
|
|
||||||
|
for _, route := range routes {
|
||||||
|
assert.Equal(t, route.Advertised, true)
|
||||||
|
assert.Equal(t, route.Enabled, false)
|
||||||
|
assert.Equal(t, route.IsPrimary, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, route := range routes {
|
||||||
|
_, err = headscale.Execute(
|
||||||
|
[]string{
|
||||||
|
"headscale",
|
||||||
|
"routes",
|
||||||
|
"enable",
|
||||||
|
"--route",
|
||||||
|
strconv.Itoa(int(route.Id)),
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var enablingRoutes []*v1.Route
|
||||||
|
err = executeAndUnmarshal(
|
||||||
|
headscale,
|
||||||
|
[]string{
|
||||||
|
"headscale",
|
||||||
|
"routes",
|
||||||
|
"list",
|
||||||
|
"--output",
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
&enablingRoutes,
|
||||||
|
)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
for _, route := range enablingRoutes {
|
||||||
|
assert.Equal(t, route.Advertised, true)
|
||||||
|
assert.Equal(t, route.Enabled, true)
|
||||||
|
assert.Equal(t, route.IsPrimary, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
routeIDToBeDisabled := enablingRoutes[0].Id
|
||||||
|
|
||||||
|
_, err = headscale.Execute(
|
||||||
|
[]string{
|
||||||
|
"headscale",
|
||||||
|
"routes",
|
||||||
|
"disable",
|
||||||
|
"--route",
|
||||||
|
strconv.Itoa(int(routeIDToBeDisabled)),
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
var disablingRoutes []*v1.Route
|
||||||
|
err = executeAndUnmarshal(
|
||||||
|
headscale,
|
||||||
|
[]string{
|
||||||
|
"headscale",
|
||||||
|
"routes",
|
||||||
|
"list",
|
||||||
|
"--output",
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
&disablingRoutes,
|
||||||
|
)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
for _, route := range disablingRoutes {
|
||||||
|
assert.Equal(t, true, route.Advertised)
|
||||||
|
|
||||||
|
if route.Id == routeIDToBeDisabled {
|
||||||
|
assert.Equal(t, route.Enabled, false)
|
||||||
|
assert.Equal(t, route.IsPrimary, false)
|
||||||
|
} else {
|
||||||
|
assert.Equal(t, route.Enabled, true)
|
||||||
|
assert.Equal(t, route.IsPrimary, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1243,199 +1243,6 @@ func (s *IntegrationCLITestSuite) TestNodeRenameCommand() {
|
|||||||
assert.Contains(s.T(), listAllAfterRenameAttempt[4].GetGivenName(), "machine-5")
|
assert.Contains(s.T(), listAllAfterRenameAttempt[4].GetGivenName(), "machine-5")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *IntegrationCLITestSuite) TestRouteCommand() {
|
|
||||||
namespace, err := s.createNamespace("routes-namespace")
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
// Randomly generated machine keys
|
|
||||||
machineKey := "nodekey:9b2ffa7e08cc421a3d2cca9012280f6a236fd0de0b4ce005b30a98ad930306fe"
|
|
||||||
|
|
||||||
_, _, err = ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"debug",
|
|
||||||
"create-node",
|
|
||||||
"--name",
|
|
||||||
"route-machine",
|
|
||||||
"--namespace",
|
|
||||||
namespace.Name,
|
|
||||||
"--key",
|
|
||||||
machineKey,
|
|
||||||
"--route",
|
|
||||||
"10.0.0.0/8",
|
|
||||||
"--route",
|
|
||||||
"192.168.1.0/24",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
machineResult, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"nodes",
|
|
||||||
"--namespace",
|
|
||||||
namespace.Name,
|
|
||||||
"register",
|
|
||||||
"--key",
|
|
||||||
machineKey,
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
var machine v1.Machine
|
|
||||||
err = json.Unmarshal([]byte(machineResult), &machine)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Equal(s.T(), uint64(1), machine.Id)
|
|
||||||
assert.Equal(s.T(), "route-machine", machine.Name)
|
|
||||||
|
|
||||||
listAllResult, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"routes",
|
|
||||||
"list",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
"--identifier",
|
|
||||||
"0",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
var listAll v1.Routes
|
|
||||||
err = json.Unmarshal([]byte(listAllResult), &listAll)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Len(s.T(), listAll.AdvertisedRoutes, 2)
|
|
||||||
assert.Contains(s.T(), listAll.AdvertisedRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), listAll.AdvertisedRoutes, "192.168.1.0/24")
|
|
||||||
|
|
||||||
assert.Empty(s.T(), listAll.EnabledRoutes)
|
|
||||||
|
|
||||||
enableTwoRoutesResult, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"routes",
|
|
||||||
"enable",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
"--identifier",
|
|
||||||
"0",
|
|
||||||
"--route",
|
|
||||||
"10.0.0.0/8",
|
|
||||||
"--route",
|
|
||||||
"192.168.1.0/24",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
var enableTwoRoutes v1.Routes
|
|
||||||
err = json.Unmarshal([]byte(enableTwoRoutesResult), &enableTwoRoutes)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableTwoRoutes.AdvertisedRoutes, 2)
|
|
||||||
assert.Contains(s.T(), enableTwoRoutes.AdvertisedRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), enableTwoRoutes.AdvertisedRoutes, "192.168.1.0/24")
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableTwoRoutes.EnabledRoutes, 2)
|
|
||||||
assert.Contains(s.T(), enableTwoRoutes.EnabledRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), enableTwoRoutes.EnabledRoutes, "192.168.1.0/24")
|
|
||||||
|
|
||||||
// Enable only one route, effectively disabling one of the routes
|
|
||||||
enableOneRouteResult, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"routes",
|
|
||||||
"enable",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
"--identifier",
|
|
||||||
"0",
|
|
||||||
"--route",
|
|
||||||
"10.0.0.0/8",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
var enableOneRoute v1.Routes
|
|
||||||
err = json.Unmarshal([]byte(enableOneRouteResult), &enableOneRoute)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableOneRoute.AdvertisedRoutes, 2)
|
|
||||||
assert.Contains(s.T(), enableOneRoute.AdvertisedRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), enableOneRoute.AdvertisedRoutes, "192.168.1.0/24")
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableOneRoute.EnabledRoutes, 1)
|
|
||||||
assert.Contains(s.T(), enableOneRoute.EnabledRoutes, "10.0.0.0/8")
|
|
||||||
|
|
||||||
// Enable only one route, effectively disabling one of the routes
|
|
||||||
failEnableNonAdvertisedRoute, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"routes",
|
|
||||||
"enable",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
"--identifier",
|
|
||||||
"0",
|
|
||||||
"--route",
|
|
||||||
"11.0.0.0/8",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Contains(
|
|
||||||
s.T(),
|
|
||||||
string(failEnableNonAdvertisedRoute),
|
|
||||||
"route (route-machine) is not available on node",
|
|
||||||
)
|
|
||||||
|
|
||||||
// Enable all routes on host
|
|
||||||
enableAllRouteResult, _, err := ExecuteCommand(
|
|
||||||
&s.headscale,
|
|
||||||
[]string{
|
|
||||||
"headscale",
|
|
||||||
"routes",
|
|
||||||
"enable",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
"--identifier",
|
|
||||||
"0",
|
|
||||||
"--all",
|
|
||||||
},
|
|
||||||
[]string{},
|
|
||||||
)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
var enableAllRoute v1.Routes
|
|
||||||
err = json.Unmarshal([]byte(enableAllRouteResult), &enableAllRoute)
|
|
||||||
assert.Nil(s.T(), err)
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableAllRoute.AdvertisedRoutes, 2)
|
|
||||||
assert.Contains(s.T(), enableAllRoute.AdvertisedRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), enableAllRoute.AdvertisedRoutes, "192.168.1.0/24")
|
|
||||||
|
|
||||||
assert.Len(s.T(), enableAllRoute.EnabledRoutes, 2)
|
|
||||||
assert.Contains(s.T(), enableAllRoute.EnabledRoutes, "10.0.0.0/8")
|
|
||||||
assert.Contains(s.T(), enableAllRoute.EnabledRoutes, "192.168.1.0/24")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *IntegrationCLITestSuite) TestApiKeyCommand() {
|
func (s *IntegrationCLITestSuite) TestApiKeyCommand() {
|
||||||
count := 5
|
count := 5
|
||||||
|
|
||||||
|
222
machine.go
222
machine.go
@@ -13,6 +13,7 @@ import (
|
|||||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
"gorm.io/gorm"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
)
|
)
|
||||||
@@ -37,11 +38,6 @@ const (
|
|||||||
maxHostnameLength = 255
|
maxHostnameLength = 255
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
ExitRouteV4 = netip.MustParsePrefix("0.0.0.0/0")
|
|
||||||
ExitRouteV6 = netip.MustParsePrefix("::/0")
|
|
||||||
)
|
|
||||||
|
|
||||||
// Machine is a Headscale client.
|
// Machine is a Headscale client.
|
||||||
type Machine struct {
|
type Machine struct {
|
||||||
ID uint64 `gorm:"primary_key"`
|
ID uint64 `gorm:"primary_key"`
|
||||||
@@ -76,9 +72,8 @@ type Machine struct {
|
|||||||
LastSuccessfulUpdate *time.Time
|
LastSuccessfulUpdate *time.Time
|
||||||
Expiry *time.Time
|
Expiry *time.Time
|
||||||
|
|
||||||
HostInfo HostInfo
|
HostInfo HostInfo
|
||||||
Endpoints StringList
|
Endpoints StringList
|
||||||
EnabledRoutes IPPrefixes
|
|
||||||
|
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
@@ -143,6 +138,17 @@ func (machine Machine) isExpired() bool {
|
|||||||
return time.Now().UTC().After(*machine.Expiry)
|
return time.Now().UTC().After(*machine.Expiry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isOnline returns if the machine is connected to Headscale.
|
||||||
|
// This is really a naive implementation, as we don't really see
|
||||||
|
// if there is a working connection between the client and the server.
|
||||||
|
func (machine *Machine) isOnline() bool {
|
||||||
|
if machine.LastSeen == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return machine.LastSeen.After(time.Now().Add(-keepAliveInterval))
|
||||||
|
}
|
||||||
|
|
||||||
func containsAddresses(inputs []string, addrs []string) bool {
|
func containsAddresses(inputs []string, addrs []string) bool {
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
if contains(inputs, addr) {
|
if contains(inputs, addr) {
|
||||||
@@ -595,14 +601,15 @@ func (machines MachinesP) String() string {
|
|||||||
return fmt.Sprintf("[ %s ](%d)", strings.Join(temp, ", "), len(temp))
|
return fmt.Sprintf("[ %s ](%d)", strings.Join(temp, ", "), len(temp))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (machines Machines) toNodes(
|
func (h *Headscale) toNodes(
|
||||||
|
machines Machines,
|
||||||
baseDomain string,
|
baseDomain string,
|
||||||
dnsConfig *tailcfg.DNSConfig,
|
dnsConfig *tailcfg.DNSConfig,
|
||||||
) ([]*tailcfg.Node, error) {
|
) ([]*tailcfg.Node, error) {
|
||||||
nodes := make([]*tailcfg.Node, len(machines))
|
nodes := make([]*tailcfg.Node, len(machines))
|
||||||
|
|
||||||
for index, machine := range machines {
|
for index, machine := range machines {
|
||||||
node, err := machine.toNode(baseDomain, dnsConfig)
|
node, err := h.toNode(machine, baseDomain, dnsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -615,7 +622,8 @@ func (machines Machines) toNodes(
|
|||||||
|
|
||||||
// toNode converts a Machine into a Tailscale Node. includeRoutes is false for shared nodes
|
// toNode converts a Machine into a Tailscale Node. includeRoutes is false for shared nodes
|
||||||
// as per the expected behaviour in the official SaaS.
|
// as per the expected behaviour in the official SaaS.
|
||||||
func (machine Machine) toNode(
|
func (h *Headscale) toNode(
|
||||||
|
machine Machine,
|
||||||
baseDomain string,
|
baseDomain string,
|
||||||
dnsConfig *tailcfg.DNSConfig,
|
dnsConfig *tailcfg.DNSConfig,
|
||||||
) (*tailcfg.Node, error) {
|
) (*tailcfg.Node, error) {
|
||||||
@@ -663,24 +671,19 @@ func (machine Machine) toNode(
|
|||||||
[]netip.Prefix{},
|
[]netip.Prefix{},
|
||||||
addrs...) // we append the node own IP, as it is required by the clients
|
addrs...) // we append the node own IP, as it is required by the clients
|
||||||
|
|
||||||
allowedIPs = append(allowedIPs, machine.EnabledRoutes...)
|
enabledRoutes, err := h.GetEnabledRoutes(&machine)
|
||||||
|
if err != nil {
|
||||||
// TODO(kradalby): This is kind of a hack where we say that
|
return nil, err
|
||||||
// all the announced routes (except exit), is presented as primary
|
|
||||||
// routes. This might be problematic if two nodes expose the same route.
|
|
||||||
// This was added to address an issue where subnet routers stopped working
|
|
||||||
// when we only populated AllowedIPs.
|
|
||||||
primaryRoutes := []netip.Prefix{}
|
|
||||||
if len(machine.EnabledRoutes) > 0 {
|
|
||||||
for _, route := range machine.EnabledRoutes {
|
|
||||||
if route == ExitRouteV4 || route == ExitRouteV6 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
primaryRoutes = append(primaryRoutes, route)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allowedIPs = append(allowedIPs, enabledRoutes...)
|
||||||
|
|
||||||
|
primaryRoutes, err := h.getMachinePrimaryRoutes(&machine)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
primaryPrefixes := Routes(primaryRoutes).toPrefixes()
|
||||||
|
|
||||||
var derp string
|
var derp string
|
||||||
if machine.HostInfo.NetInfo != nil {
|
if machine.HostInfo.NetInfo != nil {
|
||||||
derp = fmt.Sprintf("127.3.3.40:%d", machine.HostInfo.NetInfo.PreferredDERP)
|
derp = fmt.Sprintf("127.3.3.40:%d", machine.HostInfo.NetInfo.PreferredDERP)
|
||||||
@@ -716,9 +719,7 @@ func (machine Machine) toNode(
|
|||||||
|
|
||||||
hostInfo := machine.GetHostInfo()
|
hostInfo := machine.GetHostInfo()
|
||||||
|
|
||||||
// A node is Online if it is connected to the control server,
|
online := machine.isOnline()
|
||||||
// and we now we update LastSeen every keepAliveInterval duration at least.
|
|
||||||
online := machine.LastSeen.After(time.Now().Add(-keepAliveInterval))
|
|
||||||
|
|
||||||
node := tailcfg.Node{
|
node := tailcfg.Node{
|
||||||
ID: tailcfg.NodeID(machine.ID), // this is the actual ID
|
ID: tailcfg.NodeID(machine.ID), // this is the actual ID
|
||||||
@@ -733,7 +734,7 @@ func (machine Machine) toNode(
|
|||||||
DiscoKey: discoKey,
|
DiscoKey: discoKey,
|
||||||
Addresses: addrs,
|
Addresses: addrs,
|
||||||
AllowedIPs: allowedIPs,
|
AllowedIPs: allowedIPs,
|
||||||
PrimaryRoutes: primaryRoutes,
|
PrimaryRoutes: primaryPrefixes,
|
||||||
Endpoints: machine.Endpoints,
|
Endpoints: machine.Endpoints,
|
||||||
DERP: derp,
|
DERP: derp,
|
||||||
|
|
||||||
@@ -927,21 +928,69 @@ func (h *Headscale) RegisterMachine(machine Machine,
|
|||||||
return &machine, nil
|
return &machine, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (machine *Machine) GetAdvertisedRoutes() []netip.Prefix {
|
// GetAdvertisedRoutes returns the routes that are be advertised by the given machine.
|
||||||
return machine.HostInfo.RoutableIPs
|
func (h *Headscale) GetAdvertisedRoutes(machine *Machine) ([]netip.Prefix, error) {
|
||||||
|
routes := []Route{}
|
||||||
|
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("machine_id = ? AND advertised = ?", machine.ID, true).Find(&routes).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Str("machine", machine.Hostname).
|
||||||
|
Msg("Could not get advertised routes for machine")
|
||||||
|
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
prefixes := []netip.Prefix{}
|
||||||
|
for _, route := range routes {
|
||||||
|
prefixes = append(prefixes, netip.Prefix(route.Prefix))
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefixes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (machine *Machine) GetEnabledRoutes() []netip.Prefix {
|
// GetEnabledRoutes returns the routes that are enabled for the machine.
|
||||||
return machine.EnabledRoutes
|
func (h *Headscale) GetEnabledRoutes(machine *Machine) ([]netip.Prefix, error) {
|
||||||
|
routes := []Route{}
|
||||||
|
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("machine_id = ? AND advertised = ? AND enabled = ?", machine.ID, true, true).
|
||||||
|
Find(&routes).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Str("machine", machine.Hostname).
|
||||||
|
Msg("Could not get enabled routes for machine")
|
||||||
|
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
prefixes := []netip.Prefix{}
|
||||||
|
for _, route := range routes {
|
||||||
|
prefixes = append(prefixes, netip.Prefix(route.Prefix))
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefixes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (machine *Machine) IsRoutesEnabled(routeStr string) bool {
|
func (h *Headscale) IsRoutesEnabled(machine *Machine, routeStr string) bool {
|
||||||
route, err := netip.ParsePrefix(routeStr)
|
route, err := netip.ParsePrefix(routeStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
enabledRoutes := machine.GetEnabledRoutes()
|
enabledRoutes, err := h.GetEnabledRoutes(machine)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Could not get enabled routes")
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, enabledRoute := range enabledRoutes {
|
for _, enabledRoute := range enabledRoutes {
|
||||||
if route == enabledRoute {
|
if route == enabledRoute {
|
||||||
@@ -952,8 +1001,7 @@ func (machine *Machine) IsRoutesEnabled(routeStr string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableNodeRoute enables new routes based on a list of new routes. It will _replace_ the
|
// EnableRoutes enables new routes based on a list of new routes.
|
||||||
// previous list of routes.
|
|
||||||
func (h *Headscale) EnableRoutes(machine *Machine, routeStrs ...string) error {
|
func (h *Headscale) EnableRoutes(machine *Machine, routeStrs ...string) error {
|
||||||
newRoutes := make([]netip.Prefix, len(routeStrs))
|
newRoutes := make([]netip.Prefix, len(routeStrs))
|
||||||
for index, routeStr := range routeStrs {
|
for index, routeStr := range routeStrs {
|
||||||
@@ -965,8 +1013,13 @@ func (h *Headscale) EnableRoutes(machine *Machine, routeStrs ...string) error {
|
|||||||
newRoutes[index] = route
|
newRoutes[index] = route
|
||||||
}
|
}
|
||||||
|
|
||||||
|
advertisedRoutes, err := h.GetAdvertisedRoutes(machine)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, newRoute := range newRoutes {
|
for _, newRoute := range newRoutes {
|
||||||
if !contains(machine.GetAdvertisedRoutes(), newRoute) {
|
if !contains(advertisedRoutes, newRoute) {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"route (%s) is not available on node %s: %w",
|
"route (%s) is not available on node %s: %w",
|
||||||
machine.Hostname,
|
machine.Hostname,
|
||||||
@@ -975,52 +1028,77 @@ func (h *Headscale) EnableRoutes(machine *Machine, routeStrs ...string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
machine.EnabledRoutes = newRoutes
|
// Separate loop so we don't leave things in a half-updated state
|
||||||
|
for _, prefix := range newRoutes {
|
||||||
|
route := Route{}
|
||||||
|
err := h.db.Preload("Machine").
|
||||||
|
Where("machine_id = ? AND prefix = ?", machine.ID, IPPrefix(prefix)).
|
||||||
|
First(&route).Error
|
||||||
|
if err == nil {
|
||||||
|
route.Enabled = true
|
||||||
|
|
||||||
if err := h.db.Save(machine).Error; err != nil {
|
// Mark already as primary if there is only this node offering this subnet
|
||||||
return fmt.Errorf("failed enable routes for machine in the database: %w", err)
|
// (and is not an exit route)
|
||||||
|
if !route.isExitRoute() {
|
||||||
|
route.IsPrimary = h.isUniquePrefix(route)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = h.db.Save(&route).Error
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to enable route: %w", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("failed to find route: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enabled any routes advertised by a machine that match the ACL autoApprovers policy.
|
// EnableAutoApprovedRoutes enables any routes advertised by a machine that match the ACL autoApprovers policy.
|
||||||
func (h *Headscale) EnableAutoApprovedRoutes(machine *Machine) {
|
func (h *Headscale) EnableAutoApprovedRoutes(machine *Machine) error {
|
||||||
if len(machine.IPAddresses) == 0 {
|
if len(machine.IPAddresses) == 0 {
|
||||||
return // This machine has no IPAddresses, so can't possibly match any autoApprovers ACLs
|
return nil // This machine has no IPAddresses, so can't possibly match any autoApprovers ACLs
|
||||||
}
|
}
|
||||||
|
|
||||||
approvedRoutes := make([]netip.Prefix, 0, len(machine.HostInfo.RoutableIPs))
|
routes := []Route{}
|
||||||
thisMachine := []Machine{*machine}
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("machine_id = ? AND advertised = true AND enabled = false", machine.ID).Find(&routes).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Str("machine", machine.Hostname).
|
||||||
|
Msg("Could not get advertised routes for machine")
|
||||||
|
|
||||||
for _, advertisedRoute := range machine.HostInfo.RoutableIPs {
|
return err
|
||||||
if contains(machine.EnabledRoutes, advertisedRoute) {
|
}
|
||||||
continue // Skip routes that are already enabled for the node
|
|
||||||
}
|
|
||||||
|
|
||||||
routeApprovers, err := h.aclPolicy.AutoApprovers.GetRouteApprovers(
|
approvedRoutes := []Route{}
|
||||||
advertisedRoute,
|
|
||||||
)
|
for _, advertisedRoute := range routes {
|
||||||
|
routeApprovers, err := h.aclPolicy.AutoApprovers.GetRouteApprovers(netip.Prefix(advertisedRoute.Prefix))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).
|
log.Err(err).
|
||||||
Str("advertisedRoute", advertisedRoute.String()).
|
Str("advertisedRoute", advertisedRoute.String()).
|
||||||
Uint64("machineId", machine.ID).
|
Uint64("machineId", machine.ID).
|
||||||
Msg("Failed to resolve autoApprovers for advertised route")
|
Msg("Failed to resolve autoApprovers for advertised route")
|
||||||
|
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, approvedAlias := range routeApprovers {
|
for _, approvedAlias := range routeApprovers {
|
||||||
if approvedAlias == machine.Namespace.Name {
|
if approvedAlias == machine.Namespace.Name {
|
||||||
approvedRoutes = append(approvedRoutes, advertisedRoute)
|
approvedRoutes = append(approvedRoutes, advertisedRoute)
|
||||||
} else {
|
} else {
|
||||||
approvedIps, err := expandAlias(thisMachine, *h.aclPolicy, approvedAlias, h.cfg.OIDC.StripEmaildomain)
|
approvedIps, err := expandAlias([]Machine{*machine}, *h.aclPolicy, approvedAlias, h.cfg.OIDC.StripEmaildomain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).
|
log.Err(err).
|
||||||
Str("alias", approvedAlias).
|
Str("alias", approvedAlias).
|
||||||
Msg("Failed to expand alias when processing autoApprovers policy")
|
Msg("Failed to expand alias when processing autoApprovers policy")
|
||||||
|
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// approvedIPs should contain all of machine's IPs if it matches the rule, so check for first
|
// approvedIPs should contain all of machine's IPs if it matches the rule, so check for first
|
||||||
@@ -1031,26 +1109,20 @@ func (h *Headscale) EnableAutoApprovedRoutes(machine *Machine) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, approvedRoute := range approvedRoutes {
|
for i, approvedRoute := range approvedRoutes {
|
||||||
if !contains(machine.EnabledRoutes, approvedRoute) {
|
approvedRoutes[i].Enabled = true
|
||||||
log.Info().
|
err = h.db.Save(&approvedRoutes[i]).Error
|
||||||
Str("route", approvedRoute.String()).
|
if err != nil {
|
||||||
Uint64("client", machine.ID).
|
log.Err(err).
|
||||||
Msg("Enabling autoApproved route for client")
|
Str("approvedRoute", approvedRoute.String()).
|
||||||
machine.EnabledRoutes = append(machine.EnabledRoutes, approvedRoute)
|
Uint64("machineId", machine.ID).
|
||||||
|
Msg("Failed to enable approved route")
|
||||||
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (machine *Machine) RoutesToProto() *v1.Routes {
|
return nil
|
||||||
availableRoutes := machine.GetAdvertisedRoutes()
|
|
||||||
|
|
||||||
enabledRoutes := machine.GetEnabledRoutes()
|
|
||||||
|
|
||||||
return &v1.Routes{
|
|
||||||
AdvertisedRoutes: ipPrefixToString(availableRoutes),
|
|
||||||
EnabledRoutes: ipPrefixToString(enabledRoutes),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) generateGivenName(suppliedName string, randomSuffix bool) (string, error) {
|
func (h *Headscale) generateGivenName(suppliedName string, randomSuffix bool) (string, error) {
|
||||||
|
@@ -1153,9 +1153,16 @@ func (s *Suite) TestAutoApproveRoutes(c *check.C) {
|
|||||||
|
|
||||||
app.db.Save(&machine)
|
app.db.Save(&machine)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
machine0ByID, err := app.GetMachineByID(0)
|
machine0ByID, err := app.GetMachineByID(0)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
app.EnableAutoApprovedRoutes(machine0ByID)
|
err = app.EnableAutoApprovedRoutes(machine0ByID)
|
||||||
c.Assert(machine0ByID.GetEnabledRoutes(), check.HasLen, 3)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
enabledRoutes, err := app.GetEnabledRoutes(machine0ByID)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(enabledRoutes, check.HasLen, 3)
|
||||||
}
|
}
|
||||||
|
@@ -126,17 +126,31 @@ service HeadscaleService {
|
|||||||
// --- Machine end ---
|
// --- Machine end ---
|
||||||
|
|
||||||
// --- Route start ---
|
// --- 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) = {
|
option (google.api.http) = {
|
||||||
get: "/api/v1/machine/{machine_id}/routes"
|
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 ---
|
// --- Route end ---
|
||||||
|
|
||||||
// --- ApiKeys start ---
|
// --- ApiKeys start ---
|
||||||
|
@@ -2,24 +2,47 @@ syntax = "proto3";
|
|||||||
package headscale.v1;
|
package headscale.v1;
|
||||||
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
option go_package = "github.com/juanfont/headscale/gen/go/v1";
|
||||||
|
|
||||||
message Routes {
|
import "google/protobuf/timestamp.proto";
|
||||||
repeated string advertised_routes = 1;
|
import "headscale/v1/machine.proto";
|
||||||
repeated string enabled_routes = 2;
|
|
||||||
|
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;
|
uint64 machine_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetMachineRouteResponse {
|
message GetMachineRoutesResponse {
|
||||||
Routes routes = 1;
|
repeated Route routes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message EnableMachineRoutesRequest {
|
|
||||||
uint64 machine_id = 1;
|
|
||||||
repeated string routes = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message EnableMachineRoutesResponse {
|
|
||||||
Routes routes = 1;
|
|
||||||
}
|
|
@@ -32,6 +32,15 @@ func (h *Headscale) handlePollCommon(
|
|||||||
machine.DiscoKey = DiscoPublicKeyStripPrefix(mapRequest.DiscoKey)
|
machine.DiscoKey = DiscoPublicKeyStripPrefix(mapRequest.DiscoKey)
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
|
|
||||||
|
err := h.processMachineRoutes(machine)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Str("machine", machine.Hostname).
|
||||||
|
Msg("Error processing machine routes")
|
||||||
|
}
|
||||||
|
|
||||||
// update ACLRules with peer informations (to update server tags if necessary)
|
// update ACLRules with peer informations (to update server tags if necessary)
|
||||||
if h.aclPolicy != nil {
|
if h.aclPolicy != nil {
|
||||||
err := h.UpdateACLRules()
|
err := h.UpdateACLRules()
|
||||||
@@ -44,7 +53,15 @@ func (h *Headscale) handlePollCommon(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update routes with peer information
|
// update routes with peer information
|
||||||
h.EnableAutoApprovedRoutes(machine)
|
err = h.EnableAutoApprovedRoutes(machine)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Bool("noise", isNoise).
|
||||||
|
Str("machine", machine.Hostname).
|
||||||
|
Err(err).
|
||||||
|
Msg("Error running auto approved routes")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From Tailscale client:
|
// From Tailscale client:
|
||||||
|
356
routes.go
356
routes.go
@@ -1,118 +1,338 @@
|
|||||||
package headscale
|
package headscale
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
|
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ErrRouteIsNotAvailable = Error("route is not available")
|
ErrRouteIsNotAvailable = Error("route is not available")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deprecated: use machine function instead
|
var (
|
||||||
// GetAdvertisedNodeRoutes returns the subnet routes advertised by a node (identified by
|
ExitRouteV4 = netip.MustParsePrefix("0.0.0.0/0")
|
||||||
// namespace and node name).
|
ExitRouteV6 = netip.MustParsePrefix("::/0")
|
||||||
func (h *Headscale) GetAdvertisedNodeRoutes(
|
)
|
||||||
namespace string,
|
|
||||||
nodeName string,
|
type Route struct {
|
||||||
) (*[]netip.Prefix, error) {
|
gorm.Model
|
||||||
machine, err := h.GetMachine(namespace, nodeName)
|
|
||||||
|
MachineID uint64
|
||||||
|
Machine Machine
|
||||||
|
Prefix IPPrefix
|
||||||
|
|
||||||
|
Advertised bool
|
||||||
|
Enabled bool
|
||||||
|
IsPrimary bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type Routes []Route
|
||||||
|
|
||||||
|
func (r *Route) String() string {
|
||||||
|
return fmt.Sprintf("%s:%s", r.Machine, netip.Prefix(r.Prefix).String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Route) isExitRoute() bool {
|
||||||
|
return netip.Prefix(r.Prefix) == ExitRouteV4 || netip.Prefix(r.Prefix) == ExitRouteV6
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rs Routes) toPrefixes() []netip.Prefix {
|
||||||
|
prefixes := make([]netip.Prefix, len(rs))
|
||||||
|
for i, r := range rs {
|
||||||
|
prefixes[i] = netip.Prefix(r.Prefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefixes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) GetRoutes() ([]Route, error) {
|
||||||
|
var routes []Route
|
||||||
|
err := h.db.Preload("Machine").Find(&routes).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &machine.HostInfo.RoutableIPs, nil
|
return routes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use machine function instead
|
func (h *Headscale) GetMachineRoutes(m *Machine) ([]Route, error) {
|
||||||
// GetEnabledNodeRoutes returns the subnet routes enabled by a node (identified by
|
var routes []Route
|
||||||
// namespace and node name).
|
err := h.db.
|
||||||
func (h *Headscale) GetEnabledNodeRoutes(
|
Preload("Machine").
|
||||||
namespace string,
|
Where("machine_id = ?", m.ID).
|
||||||
nodeName string,
|
Find(&routes).Error
|
||||||
) ([]netip.Prefix, error) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
machine, err := h.GetMachine(namespace, nodeName)
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return routes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) GetRoute(id uint64) (*Route, error) {
|
||||||
|
var route Route
|
||||||
|
err := h.db.Preload("Machine").First(&route, id).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return machine.EnabledRoutes, nil
|
return &route, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use machine function instead
|
func (h *Headscale) EnableRoute(id uint64) error {
|
||||||
// IsNodeRouteEnabled checks if a certain route has been enabled.
|
route, err := h.GetRoute(id)
|
||||||
func (h *Headscale) IsNodeRouteEnabled(
|
|
||||||
namespace string,
|
|
||||||
nodeName string,
|
|
||||||
routeStr string,
|
|
||||||
) bool {
|
|
||||||
route, err := netip.ParsePrefix(routeStr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
enabledRoutes, err := h.GetEnabledNodeRoutes(namespace, nodeName)
|
return h.EnableRoutes(&route.Machine, netip.Prefix(route.Prefix).String())
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, enabledRoute := range enabledRoutes {
|
|
||||||
if route == enabledRoute {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use EnableRoute in machine.go
|
func (h *Headscale) DisableRoute(id uint64) error {
|
||||||
// EnableNodeRoute enables a subnet route advertised by a node (identified by
|
route, err := h.GetRoute(id)
|
||||||
// namespace and node name).
|
|
||||||
func (h *Headscale) EnableNodeRoute(
|
|
||||||
namespace string,
|
|
||||||
nodeName string,
|
|
||||||
routeStr string,
|
|
||||||
) error {
|
|
||||||
machine, err := h.GetMachine(namespace, nodeName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
route, err := netip.ParsePrefix(routeStr)
|
route.Enabled = false
|
||||||
|
route.IsPrimary = false
|
||||||
|
err = h.db.Save(route).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
availableRoutes, err := h.GetAdvertisedNodeRoutes(namespace, nodeName)
|
return h.handlePrimarySubnetFailover()
|
||||||
|
}
|
||||||
|
|
||||||
|
// isUniquePrefix returns if there is another machine providing the same route already.
|
||||||
|
func (h *Headscale) isUniquePrefix(route Route) bool {
|
||||||
|
var count int64
|
||||||
|
h.db.
|
||||||
|
Model(&Route{}).
|
||||||
|
Where("prefix = ? AND machine_id != ? AND advertised = ? AND enabled = ?",
|
||||||
|
route.Prefix,
|
||||||
|
route.MachineID,
|
||||||
|
true, true).Count(&count)
|
||||||
|
|
||||||
|
return count == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) getPrimaryRoute(prefix netip.Prefix) (*Route, error) {
|
||||||
|
var route Route
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("prefix = ? AND advertised = ? AND enabled = ? AND is_primary = ?", IPPrefix(prefix), true, true, true).
|
||||||
|
First(&route).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return nil, gorm.ErrRecordNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return &route, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getMachinePrimaryRoutes returns the routes that are enabled and marked as primary (for subnet failover)
|
||||||
|
// Exit nodes are not considered for this, as they are never marked as Primary.
|
||||||
|
func (h *Headscale) getMachinePrimaryRoutes(m *Machine) ([]Route, error) {
|
||||||
|
var routes []Route
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("machine_id = ? AND advertised = ? AND enabled = ? AND is_primary = ?", m.ID, true, true, true).
|
||||||
|
Find(&routes).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return routes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) processMachineRoutes(machine *Machine) error {
|
||||||
|
currentRoutes := []Route{}
|
||||||
|
err := h.db.Where("machine_id = ?", machine.ID).Find(¤tRoutes).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
enabledRoutes, err := h.GetEnabledNodeRoutes(namespace, nodeName)
|
advertisedRoutes := map[netip.Prefix]bool{}
|
||||||
if err != nil {
|
for _, prefix := range machine.HostInfo.RoutableIPs {
|
||||||
return err
|
advertisedRoutes[prefix] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
available := false
|
for pos, route := range currentRoutes {
|
||||||
for _, availableRoute := range *availableRoutes {
|
if _, ok := advertisedRoutes[netip.Prefix(route.Prefix)]; ok {
|
||||||
// If the route is available, and not yet enabled, add it to the new routing table
|
if !route.Advertised {
|
||||||
if route == availableRoute {
|
currentRoutes[pos].Advertised = true
|
||||||
available = true
|
err := h.db.Save(¤tRoutes[pos]).Error
|
||||||
if !h.IsNodeRouteEnabled(namespace, nodeName, routeStr) {
|
if err != nil {
|
||||||
enabledRoutes = append(enabledRoutes, route)
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
advertisedRoutes[netip.Prefix(route.Prefix)] = true
|
||||||
|
} else if route.Advertised {
|
||||||
|
currentRoutes[pos].Advertised = false
|
||||||
|
currentRoutes[pos].Enabled = false
|
||||||
|
err := h.db.Save(¤tRoutes[pos]).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !available {
|
for prefix, exists := range advertisedRoutes {
|
||||||
return ErrRouteIsNotAvailable
|
if !exists {
|
||||||
}
|
route := Route{
|
||||||
|
MachineID: machine.ID,
|
||||||
machine.EnabledRoutes = enabledRoutes
|
Prefix: IPPrefix(prefix),
|
||||||
|
Advertised: true,
|
||||||
if err := h.db.Save(&machine).Error; err != nil {
|
Enabled: false,
|
||||||
return fmt.Errorf("failed to update node routes in the database: %w", err)
|
}
|
||||||
|
err := h.db.Create(&route).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *Headscale) handlePrimarySubnetFailover() error {
|
||||||
|
// first, get all the enabled routes
|
||||||
|
var routes []Route
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("advertised = ? AND enabled = ?", true, true).
|
||||||
|
Find(&routes).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Error().Err(err).Msg("error getting routes")
|
||||||
|
}
|
||||||
|
|
||||||
|
for pos, route := range routes {
|
||||||
|
if route.isExitRoute() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if !route.IsPrimary {
|
||||||
|
_, err := h.getPrimaryRoute(netip.Prefix(route.Prefix))
|
||||||
|
if h.isUniquePrefix(route) || errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Info().
|
||||||
|
Str("prefix", netip.Prefix(route.Prefix).String()).
|
||||||
|
Str("machine", route.Machine.GivenName).
|
||||||
|
Msg("Setting primary route")
|
||||||
|
routes[pos].IsPrimary = true
|
||||||
|
err := h.db.Save(&routes[pos]).Error
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error marking route as primary")
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if route.IsPrimary {
|
||||||
|
if route.Machine.isOnline() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// machine offline, find a new primary
|
||||||
|
log.Info().
|
||||||
|
Str("machine", route.Machine.Hostname).
|
||||||
|
Str("prefix", netip.Prefix(route.Prefix).String()).
|
||||||
|
Msgf("machine offline, finding a new primary subnet")
|
||||||
|
|
||||||
|
// find a new primary route
|
||||||
|
var newPrimaryRoutes []Route
|
||||||
|
err := h.db.
|
||||||
|
Preload("Machine").
|
||||||
|
Where("prefix = ? AND machine_id != ? AND advertised = ? AND enabled = ?",
|
||||||
|
route.Prefix,
|
||||||
|
route.MachineID,
|
||||||
|
true, true).
|
||||||
|
Find(&newPrimaryRoutes).Error
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
log.Error().Err(err).Msg("error finding new primary route")
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var newPrimaryRoute *Route
|
||||||
|
for pos, r := range newPrimaryRoutes {
|
||||||
|
if r.Machine.isOnline() {
|
||||||
|
newPrimaryRoute = &newPrimaryRoutes[pos]
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if newPrimaryRoute == nil {
|
||||||
|
log.Warn().
|
||||||
|
Str("machine", route.Machine.Hostname).
|
||||||
|
Str("prefix", netip.Prefix(route.Prefix).String()).
|
||||||
|
Msgf("no alternative primary route found")
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info().
|
||||||
|
Str("old_machine", route.Machine.Hostname).
|
||||||
|
Str("prefix", netip.Prefix(route.Prefix).String()).
|
||||||
|
Str("new_machine", newPrimaryRoute.Machine.Hostname).
|
||||||
|
Msgf("found new primary route")
|
||||||
|
|
||||||
|
// disable the old primary route
|
||||||
|
routes[pos].IsPrimary = false
|
||||||
|
err = h.db.Save(&routes[pos]).Error
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error disabling old primary route")
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable the new primary route
|
||||||
|
newPrimaryRoute.IsPrimary = true
|
||||||
|
err = h.db.Save(&newPrimaryRoute).Error
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error enabling new primary route")
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rs Routes) toProto() []*v1.Route {
|
||||||
|
protoRoutes := []*v1.Route{}
|
||||||
|
|
||||||
|
for _, route := range rs {
|
||||||
|
protoRoute := v1.Route{
|
||||||
|
Id: uint64(route.ID),
|
||||||
|
Machine: route.Machine.toProto(),
|
||||||
|
Prefix: netip.Prefix(route.Prefix).String(),
|
||||||
|
Advertised: route.Advertised,
|
||||||
|
Enabled: route.Enabled,
|
||||||
|
IsPrimary: route.IsPrimary,
|
||||||
|
CreatedAt: timestamppb.New(route.CreatedAt),
|
||||||
|
UpdatedAt: timestamppb.New(route.UpdatedAt),
|
||||||
|
}
|
||||||
|
|
||||||
|
if route.DeletedAt.Valid {
|
||||||
|
protoRoute.DeletedAt = timestamppb.New(route.DeletedAt.Time)
|
||||||
|
}
|
||||||
|
|
||||||
|
protoRoutes = append(protoRoutes, &protoRoute)
|
||||||
|
}
|
||||||
|
|
||||||
|
return protoRoutes
|
||||||
|
}
|
||||||
|
277
routes_test.go
277
routes_test.go
@@ -2,6 +2,7 @@ package headscale
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gopkg.in/check.v1"
|
"gopkg.in/check.v1"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
@@ -37,17 +38,17 @@ func (s *Suite) TestGetRoutes(c *check.C) {
|
|||||||
}
|
}
|
||||||
app.db.Save(&machine)
|
app.db.Save(&machine)
|
||||||
|
|
||||||
advertisedRoutes, err := app.GetAdvertisedNodeRoutes(
|
err = app.processMachineRoutes(&machine)
|
||||||
"test",
|
|
||||||
"test_get_route_machine",
|
|
||||||
)
|
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(*advertisedRoutes), check.Equals, 1)
|
|
||||||
|
|
||||||
err = app.EnableNodeRoute("test", "test_get_route_machine", "192.168.0.0/24")
|
advertisedRoutes, err := app.GetAdvertisedRoutes(&machine)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(advertisedRoutes), check.Equals, 1)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine, "192.168.0.0/24")
|
||||||
c.Assert(err, check.NotNil)
|
c.Assert(err, check.NotNil)
|
||||||
|
|
||||||
err = app.EnableNodeRoute("test", "test_get_route_machine", "10.0.0.0/24")
|
err = app.EnableRoutes(&machine, "10.0.0.0/24")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,48 +89,266 @@ func (s *Suite) TestGetEnableRoutes(c *check.C) {
|
|||||||
}
|
}
|
||||||
app.db.Save(&machine)
|
app.db.Save(&machine)
|
||||||
|
|
||||||
availableRoutes, err := app.GetAdvertisedNodeRoutes(
|
err = app.processMachineRoutes(&machine)
|
||||||
"test",
|
|
||||||
"test_enable_route_machine",
|
|
||||||
)
|
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(*availableRoutes), check.Equals, 2)
|
|
||||||
|
|
||||||
noEnabledRoutes, err := app.GetEnabledNodeRoutes(
|
availableRoutes, err := app.GetAdvertisedRoutes(&machine)
|
||||||
"test",
|
c.Assert(err, check.IsNil)
|
||||||
"test_enable_route_machine",
|
c.Assert(err, check.IsNil)
|
||||||
)
|
c.Assert(len(availableRoutes), check.Equals, 2)
|
||||||
|
|
||||||
|
noEnabledRoutes, err := app.GetEnabledRoutes(&machine)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(noEnabledRoutes), check.Equals, 0)
|
c.Assert(len(noEnabledRoutes), check.Equals, 0)
|
||||||
|
|
||||||
err = app.EnableNodeRoute("test", "test_enable_route_machine", "192.168.0.0/24")
|
err = app.EnableRoutes(&machine, "192.168.0.0/24")
|
||||||
c.Assert(err, check.NotNil)
|
c.Assert(err, check.NotNil)
|
||||||
|
|
||||||
err = app.EnableNodeRoute("test", "test_enable_route_machine", "10.0.0.0/24")
|
err = app.EnableRoutes(&machine, "10.0.0.0/24")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
enabledRoutes, err := app.GetEnabledNodeRoutes("test", "test_enable_route_machine")
|
enabledRoutes, err := app.GetEnabledRoutes(&machine)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(enabledRoutes), check.Equals, 1)
|
c.Assert(len(enabledRoutes), check.Equals, 1)
|
||||||
|
|
||||||
// Adding it twice will just let it pass through
|
// Adding it twice will just let it pass through
|
||||||
err = app.EnableNodeRoute("test", "test_enable_route_machine", "10.0.0.0/24")
|
err = app.EnableRoutes(&machine, "10.0.0.0/24")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
enableRoutesAfterDoubleApply, err := app.GetEnabledNodeRoutes(
|
enableRoutesAfterDoubleApply, err := app.GetEnabledRoutes(&machine)
|
||||||
"test",
|
|
||||||
"test_enable_route_machine",
|
|
||||||
)
|
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(enableRoutesAfterDoubleApply), check.Equals, 1)
|
c.Assert(len(enableRoutesAfterDoubleApply), check.Equals, 1)
|
||||||
|
|
||||||
err = app.EnableNodeRoute("test", "test_enable_route_machine", "150.0.10.0/25")
|
err = app.EnableRoutes(&machine, "150.0.10.0/25")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
enabledRoutesWithAdditionalRoute, err := app.GetEnabledNodeRoutes(
|
enabledRoutesWithAdditionalRoute, err := app.GetEnabledRoutes(&machine)
|
||||||
"test",
|
|
||||||
"test_enable_route_machine",
|
|
||||||
)
|
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(len(enabledRoutesWithAdditionalRoute), check.Equals, 2)
|
c.Assert(len(enabledRoutesWithAdditionalRoute), check.Equals, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Suite) TestIsUniquePrefix(c *check.C) {
|
||||||
|
namespace, err := app.CreateNamespace("test")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
pak, err := app.CreatePreAuthKey(namespace.Name, false, false, nil, nil)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
_, err = app.GetMachine("test", "test_enable_route_machine")
|
||||||
|
c.Assert(err, check.NotNil)
|
||||||
|
|
||||||
|
route, err := netip.ParsePrefix(
|
||||||
|
"10.0.0.0/24",
|
||||||
|
)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
route2, err := netip.ParsePrefix(
|
||||||
|
"150.0.10.0/25",
|
||||||
|
)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
hostInfo1 := tailcfg.Hostinfo{
|
||||||
|
RoutableIPs: []netip.Prefix{route, route2},
|
||||||
|
}
|
||||||
|
machine1 := Machine{
|
||||||
|
ID: 1,
|
||||||
|
MachineKey: "foo",
|
||||||
|
NodeKey: "bar",
|
||||||
|
DiscoKey: "faa",
|
||||||
|
Hostname: "test_enable_route_machine",
|
||||||
|
NamespaceID: namespace.ID,
|
||||||
|
RegisterMethod: RegisterMethodAuthKey,
|
||||||
|
AuthKeyID: uint(pak.ID),
|
||||||
|
HostInfo: HostInfo(hostInfo1),
|
||||||
|
}
|
||||||
|
app.db.Save(&machine1)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine1, route.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine1, route2.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
hostInfo2 := tailcfg.Hostinfo{
|
||||||
|
RoutableIPs: []netip.Prefix{route2},
|
||||||
|
}
|
||||||
|
machine2 := Machine{
|
||||||
|
ID: 2,
|
||||||
|
MachineKey: "foo",
|
||||||
|
NodeKey: "bar",
|
||||||
|
DiscoKey: "faa",
|
||||||
|
Hostname: "test_enable_route_machine",
|
||||||
|
NamespaceID: namespace.ID,
|
||||||
|
RegisterMethod: RegisterMethodAuthKey,
|
||||||
|
AuthKeyID: uint(pak.ID),
|
||||||
|
HostInfo: HostInfo(hostInfo2),
|
||||||
|
}
|
||||||
|
app.db.Save(&machine2)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine2, route2.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
enabledRoutes1, err := app.GetEnabledRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(enabledRoutes1), check.Equals, 2)
|
||||||
|
|
||||||
|
enabledRoutes2, err := app.GetEnabledRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(enabledRoutes2), check.Equals, 1)
|
||||||
|
|
||||||
|
routes, err := app.getMachinePrimaryRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 2)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Suite) TestSubnetFailover(c *check.C) {
|
||||||
|
namespace, err := app.CreateNamespace("test")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
pak, err := app.CreatePreAuthKey(namespace.Name, false, false, nil, nil)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
_, err = app.GetMachine("test", "test_enable_route_machine")
|
||||||
|
c.Assert(err, check.NotNil)
|
||||||
|
|
||||||
|
prefix, err := netip.ParsePrefix(
|
||||||
|
"10.0.0.0/24",
|
||||||
|
)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
prefix2, err := netip.ParsePrefix(
|
||||||
|
"150.0.10.0/25",
|
||||||
|
)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
hostInfo1 := tailcfg.Hostinfo{
|
||||||
|
RoutableIPs: []netip.Prefix{prefix, prefix2},
|
||||||
|
}
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
machine1 := Machine{
|
||||||
|
ID: 1,
|
||||||
|
MachineKey: "foo",
|
||||||
|
NodeKey: "bar",
|
||||||
|
DiscoKey: "faa",
|
||||||
|
Hostname: "test_enable_route_machine",
|
||||||
|
NamespaceID: namespace.ID,
|
||||||
|
RegisterMethod: RegisterMethodAuthKey,
|
||||||
|
AuthKeyID: uint(pak.ID),
|
||||||
|
HostInfo: HostInfo(hostInfo1),
|
||||||
|
LastSeen: &now,
|
||||||
|
}
|
||||||
|
app.db.Save(&machine1)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine1, prefix.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine1, prefix2.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.handlePrimarySubnetFailover()
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
enabledRoutes1, err := app.GetEnabledRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(enabledRoutes1), check.Equals, 2)
|
||||||
|
|
||||||
|
route, err := app.getPrimaryRoute(prefix)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(route.MachineID, check.Equals, machine1.ID)
|
||||||
|
|
||||||
|
hostInfo2 := tailcfg.Hostinfo{
|
||||||
|
RoutableIPs: []netip.Prefix{prefix2},
|
||||||
|
}
|
||||||
|
machine2 := Machine{
|
||||||
|
ID: 2,
|
||||||
|
MachineKey: "foo",
|
||||||
|
NodeKey: "bar",
|
||||||
|
DiscoKey: "faa",
|
||||||
|
Hostname: "test_enable_route_machine",
|
||||||
|
NamespaceID: namespace.ID,
|
||||||
|
RegisterMethod: RegisterMethodAuthKey,
|
||||||
|
AuthKeyID: uint(pak.ID),
|
||||||
|
HostInfo: HostInfo(hostInfo2),
|
||||||
|
LastSeen: &now,
|
||||||
|
}
|
||||||
|
app.db.Save(&machine2)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine2, prefix2.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.handlePrimarySubnetFailover()
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
enabledRoutes1, err = app.GetEnabledRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(enabledRoutes1), check.Equals, 2)
|
||||||
|
|
||||||
|
enabledRoutes2, err := app.GetEnabledRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(enabledRoutes2), check.Equals, 1)
|
||||||
|
|
||||||
|
routes, err := app.getMachinePrimaryRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 2)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 0)
|
||||||
|
|
||||||
|
// lets make machine1 lastseen 10 mins ago
|
||||||
|
before := now.Add(-10 * time.Minute)
|
||||||
|
machine1.LastSeen = &before
|
||||||
|
err = app.db.Save(&machine1).Error
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.handlePrimarySubnetFailover()
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 1)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 1)
|
||||||
|
|
||||||
|
machine2.HostInfo = HostInfo(tailcfg.Hostinfo{
|
||||||
|
RoutableIPs: []netip.Prefix{prefix, prefix2},
|
||||||
|
})
|
||||||
|
err = app.db.Save(&machine2).Error
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.processMachineRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.EnableRoutes(&machine2, prefix.String())
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
err = app.handlePrimarySubnetFailover()
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine1)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 0)
|
||||||
|
|
||||||
|
routes, err = app.getMachinePrimaryRoutes(&machine2)
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(len(routes), check.Equals, 2)
|
||||||
|
}
|
||||||
|
10
utils.go
10
utils.go
@@ -254,16 +254,6 @@ func GrpcSocketDialer(ctx context.Context, addr string) (net.Conn, error) {
|
|||||||
return d.DialContext(ctx, "unix", addr)
|
return d.DialContext(ctx, "unix", addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ipPrefixToString(prefixes []netip.Prefix) []string {
|
|
||||||
result := make([]string, len(prefixes))
|
|
||||||
|
|
||||||
for index, prefix := range prefixes {
|
|
||||||
result[index] = prefix.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func stringToIPPrefix(prefixes []string) ([]netip.Prefix, error) {
|
func stringToIPPrefix(prefixes []string) ([]netip.Prefix, error) {
|
||||||
result := make([]netip.Prefix, len(prefixes))
|
result := make([]netip.Prefix, len(prefixes))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user