diff --git a/namespaces.go b/namespaces.go index 8d9543e4..fb2db01a 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 28d86837..0ef01780 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 b52b900c..feab1fb2 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