route

package
v0.27.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// MinMetric max metric input
	MinMetric = 1
	// MaxMetric max metric input
	MaxMetric = 9999
	// MaxNetIDChar Max Network Identifier
	MaxNetIDChar = 40
)

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

View Source
const (
	// InvalidNetworkString invalid network type string
	InvalidNetworkString = "Invalid"
	// IPv4NetworkString IPv4 network type string
	IPv4NetworkString = "IPv4"
	// IPv6NetworkString IPv6 network type string
	IPv6NetworkString = "IPv6"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HAMap added in v0.27.5

type HAMap map[HAUniqueID][]*Route

type HAUniqueID added in v0.27.5

type HAUniqueID string

func GetHAUniqueID added in v0.11.5

func GetHAUniqueID(input *Route) HAUniqueID

GetHAUniqueID returns a highly available route ID by combining Network ID and Network range address

func (HAUniqueID) NetID added in v0.27.5

func (id HAUniqueID) NetID() NetID

NetID returns the Network ID from the HAUniqueID

func (HAUniqueID) String added in v0.27.5

func (id HAUniqueID) String() string

type ID added in v0.27.5

type ID string

type NetID added in v0.27.5

type NetID string

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
)

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

func ToPrefixType

func ToPrefixType(prefix string) NetworkType

ToPrefixType returns a prefix type

func (NetworkType) String

func (p NetworkType) String() string

String returns prefix type string

type Route

type Route struct {
	ID ID `gorm:"primaryKey"`
	// AccountID is a reference to Account that this object belongs
	AccountID   string       `gorm:"index"`
	Network     netip.Prefix `gorm:"serializer:json"`
	NetID       NetID
	Description string
	Peer        string
	PeerGroups  []string `gorm:"serializer:json"`
	NetworkType NetworkType
	Masquerade  bool
	Metric      int
	Enabled     bool
	Groups      []string `gorm:"serializer:json"`
}

Route represents a route

func (*Route) Copy

func (r *Route) Copy() *Route

Copy copies a route object

func (*Route) EventMeta added in v0.13.0

func (r *Route) EventMeta() map[string]any

EventMeta returns activity event meta related to the route

func (*Route) IsEqual

func (r *Route) IsEqual(other *Route) bool

IsEqual compares one route with the other

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL