From 7287e0259ccad80cd4a5026245a445ed1a2e5380 Mon Sep 17 00:00:00 2001 From: Juan Font Date: Thu, 2 Sep 2021 17:08:39 +0200 Subject: [PATCH] Minor linting issues --- namespaces.go | 2 +- routes.go | 2 ++ sharing_nodes.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/namespaces.go b/namespaces.go index 8d9543e..fb2db01 100644 --- a/namespaces.go +++ b/namespaces.go @@ -97,7 +97,7 @@ func (h *Headscale) ListMachinesInNamespace(name string) (*[]Machine, error) { return &machines, nil } -// ListSharedMachinesInNamespaces returns all the machines that are shared to the specified namespace +// ListSharedMachinesInNamespace returns all the machines that are shared to the specified namespace func (h *Headscale) ListSharedMachinesInNamespace(name string) (*[]Machine, error) { n, err := h.GetNamespace(name) if err != nil { diff --git a/routes.go b/routes.go index 28d8683..0ef0178 100644 --- a/routes.go +++ b/routes.go @@ -56,6 +56,7 @@ func (h *Headscale) GetEnabledNodeRoutes(namespace string, nodeName string) ([]n return routes, nil } +// IsNodeRouteEnabled checks if a certain route has been enabled func (h *Headscale) IsNodeRouteEnabled(namespace string, nodeName string, routeStr string) bool { route, err := netaddr.ParseIPPrefix(routeStr) if err != nil { @@ -129,6 +130,7 @@ func (h *Headscale) EnableNodeRoute(namespace string, nodeName string, routeStr return nil } +// RoutesToPtables converts the list of routes to a nice table func (h *Headscale) RoutesToPtables(namespace string, nodeName string, availableRoutes []netaddr.IPPrefix) pterm.TableData { d := pterm.TableData{{"Route", "Enabled"}} diff --git a/sharing_nodes.go b/sharing_nodes.go index b52b900..feab1fb 100644 --- a/sharing_nodes.go +++ b/sharing_nodes.go @@ -5,7 +5,7 @@ import "gorm.io/gorm" const errorSameNamespace = Error("Destination namespace same as origin") const errorNodeAlreadyShared = Error("Node already shared to this namespace") -// Sharing is a join table to support sharing nodes between namespaces +// SharedNode is a join table to support sharing nodes between namespaces type SharedNode struct { gorm.Model MachineID uint64