Documentation
¶
Index ¶
- Constants
- func HasV6ExitPair(id NetID, v6Merged map[NetID]struct{}) bool
- func IsV4DefaultRoute(p netip.Prefix) bool
- func IsV6DefaultRoute(p netip.Prefix) bool
- func V6ExitMergeSet(routesMap map[NetID][]*Route) map[NetID]struct{}
- type HAMap
- type HAUniqueID
- type ID
- type NetID
- type NetworkType
- type ResID
- type Route
Constants ¶
const ( // MinMetric max metric input MinMetric = 1 // MaxMetric max metric input MaxMetric = 9999 // MaxNetIDChar Max Network Identifier MaxNetIDChar = 40 // V6ExitSuffix is appended to a v4 exit node NetID to form its v6 counterpart. V6ExitSuffix = "-v6" )
Windows has some limitation regarding metric size that differ from Unix-like systems. Because of that we are limiting the min and max metric size based on Windows limits: see based on info from https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008
const ( // InvalidNetworkString invalid network type string InvalidNetworkString = "Invalid" // IPv4NetworkString IPv4 network type string IPv4NetworkString = "IPv4" // IPv6NetworkString IPv6 network type string IPv6NetworkString = "IPv6" // DomainNetworkString domain network type string DomainNetworkString = "Domain" )
Variables ¶
This section is empty.
Functions ¶
func HasV6ExitPair ¶ added in v0.71.0
HasV6ExitPair reports whether id has a paired v6 exit node in the merge set.
func IsV4DefaultRoute ¶ added in v0.71.0
IsV4DefaultRoute reports whether p is the IPv4 default route (0.0.0.0/0).
func IsV6DefaultRoute ¶ added in v0.71.0
IsV6DefaultRoute reports whether p is the IPv6 default route (::/0).
func V6ExitMergeSet ¶ added in v0.71.0
V6ExitMergeSet scans routesMap and returns the set of v6 exit node NetIDs that should be hidden from the UI because they are paired with a v4 exit node. A v6 ID is paired when it has suffix "-v6", its route is ::/0, and the base name (without "-v6") exists with route 0.0.0.0/0.
Types ¶
type HAMap ¶ added in v0.27.5
type HAMap map[HAUniqueID][]*Route
HAMap is a map of HAUniqueID to a list of routes.
type HAUniqueID ¶ added in v0.27.5
type HAUniqueID string
HAUniqueID is a unique identifier that is used to group high availability routes.
func (HAUniqueID) NetID ¶ added in v0.27.5
func (id HAUniqueID) NetID() NetID
NetID returns the NetID from the HAUniqueID
func (HAUniqueID) String ¶ added in v0.27.5
func (id HAUniqueID) String() string
type NetID ¶ added in v0.27.5
type NetID string
NetID is the route network identifier, a human-readable string.
func ExpandV6ExitPairs ¶ added in v0.71.0
ExpandV6ExitPairs appends the paired "-v6" exit node NetID for any v4 exit node (0.0.0.0/0) in ids that has a matching v6 counterpart (::/0) in routesMap. It modifies and returns the input slice.
type NetworkType ¶
type NetworkType int
NetworkType route network type
const ( // InvalidNetwork invalid network type InvalidNetwork NetworkType = iota // IPv4Network IPv4 network type IPv4Network // IPv6Network IPv6 network type IPv6Network // DomainNetwork domain network type DomainNetwork )
func ParseNetwork ¶
func ParseNetwork(networkString string) (NetworkType, netip.Prefix, error)
ParseNetwork Parses a network prefix string and returns a netip.Prefix object and if is invalid, IPv4 or IPv6
type ResID ¶ added in v0.43.0
type ResID string
ResID is the resourceID part of a route.ID (first part before the colon).
type Route ¶
type Route struct {
ID ID `gorm:"primaryKey"`
// AccountID is a reference to Account that this object belongs
AccountID string `gorm:"index"`
// Network and Domains are mutually exclusive
Network netip.Prefix `gorm:"serializer:json"`
Domains domain.List `gorm:"serializer:json"`
KeepRoute bool
NetID NetID
Description string
Peer string
PeerID string `gorm:"-"`
PeerGroups []string `gorm:"serializer:json"`
NetworkType NetworkType
Masquerade bool
Metric int
Enabled bool
Groups []string `gorm:"serializer:json"`
AccessControlGroups []string `gorm:"serializer:json"`
// SkipAutoApply indicates if this exit node route (0.0.0.0/0) should skip auto-application for client routing
SkipAutoApply bool
}
Route represents a route
func (*Route) EventMeta ¶ added in v0.13.0
EventMeta returns activity event meta related to the route
func (*Route) GetHAUniqueID ¶ added in v0.28.0
func (r *Route) GetHAUniqueID() HAUniqueID
GetHAUniqueID returns the HAUniqueID for the route, it can be used for grouping.
func (*Route) GetResourceID ¶ added in v0.35.0
GetResourceID returns the Networks ResID from the route ID. It's the part before the first colon in the ID string.