Minor linting issues

This commit is contained in:
Juan Font 2021-09-02 17:08:39 +02:00
parent d86de68b40
commit 7287e0259c
3 changed files with 4 additions and 2 deletions

View file

@ -97,7 +97,7 @@ func (h *Headscale) ListMachinesInNamespace(name string) (*[]Machine, error) {
return &machines, nil 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) { func (h *Headscale) ListSharedMachinesInNamespace(name string) (*[]Machine, error) {
n, err := h.GetNamespace(name) n, err := h.GetNamespace(name)
if err != nil { if err != nil {

View file

@ -56,6 +56,7 @@ func (h *Headscale) GetEnabledNodeRoutes(namespace string, nodeName string) ([]n
return routes, nil return routes, nil
} }
// IsNodeRouteEnabled checks if a certain route has been enabled
func (h *Headscale) IsNodeRouteEnabled(namespace string, nodeName string, routeStr string) bool { func (h *Headscale) IsNodeRouteEnabled(namespace string, nodeName string, routeStr string) bool {
route, err := netaddr.ParseIPPrefix(routeStr) route, err := netaddr.ParseIPPrefix(routeStr)
if err != nil { if err != nil {
@ -129,6 +130,7 @@ func (h *Headscale) EnableNodeRoute(namespace string, nodeName string, routeStr
return nil 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 { func (h *Headscale) RoutesToPtables(namespace string, nodeName string, availableRoutes []netaddr.IPPrefix) pterm.TableData {
d := pterm.TableData{{"Route", "Enabled"}} d := pterm.TableData{{"Route", "Enabled"}}

View file

@ -5,7 +5,7 @@ import "gorm.io/gorm"
const errorSameNamespace = Error("Destination namespace same as origin") const errorSameNamespace = Error("Destination namespace same as origin")
const errorNodeAlreadyShared = Error("Node already shared to this namespace") 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 { type SharedNode struct {
gorm.Model gorm.Model
MachineID uint64 MachineID uint64