Add Route DB model

This commit is contained in:
Juan Font 2022-11-23 18:50:30 +00:00 committed by Juan Font
parent 91559d0558
commit c78403691c

View file

@ -3,12 +3,26 @@ package headscale
import ( import (
"fmt" "fmt"
"net/netip" "net/netip"
"gorm.io/gorm"
) )
const ( const (
ErrRouteIsNotAvailable = Error("route is not available") ErrRouteIsNotAvailable = Error("route is not available")
) )
type Route struct {
gorm.Model
MachineID uint64
Machine Machine
Prefix IPPrefix
Advertised bool
Enabled bool
IsPrimary bool
}
// Deprecated: use machine function instead // Deprecated: use machine function instead
// GetAdvertisedNodeRoutes returns the subnet routes advertised by a node (identified by // GetAdvertisedNodeRoutes returns the subnet routes advertised by a node (identified by
// namespace and node name). // namespace and node name).