models

package
v0.0.0-...-ef1509a Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 92

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FailOnRouterPortConflicts = false
View Source
var InvalidPortError = errors.New("Port must be between 1024 and 65535")
View Source
var ReservedSystemComponentPorts = []int{}

Functions

This section is empty.

Types

type Model

type Model struct {
	Guid      string    `gorm:"primary_key" json:"-"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

type ModificationTag

type ModificationTag struct {
	Guid  string `gorm:"column:modification_guid" json:"guid"`
	Index uint32 `gorm:"column:modification_index" json:"index"`
}

func NewModificationTag

func NewModificationTag() (ModificationTag, error)

func (*ModificationTag) Increment

func (t *ModificationTag) Increment()

func (*ModificationTag) SucceededBy

func (m *ModificationTag) SucceededBy(other *ModificationTag) bool

type Range

type Range struct {
	// contains filtered or unexported fields
}

func NewRange

func NewRange(start, end uint64) (Range, error)

func (Range) Endpoints

func (r Range) Endpoints() (uint64, uint64)

func (Range) Overlaps

func (r Range) Overlaps(other Range) bool

func (Range) String

func (r Range) String() string

type Ranges

type Ranges []Range

type ReservablePorts

type ReservablePorts string

func (ReservablePorts) Parse

func (p ReservablePorts) Parse() (Ranges, error)

func (*ReservablePorts) UnmarshalYAML

func (p *ReservablePorts) UnmarshalYAML(unmarshal func(interface{}) error) error

func (ReservablePorts) Validate

func (p ReservablePorts) Validate() error

type Route

type Route struct {
	Model
	ExpiresAt time.Time `json:"-"`
	RouteEntity
}

func NewRoute

func NewRoute(url string, port uint16, ip, logGuid, routeServiceUrl string, ttl int) Route

func NewRouteWithModel

func NewRouteWithModel(route Route) (Route, error)

func (Route) GetTTL

func (r Route) GetTTL() int

func (*Route) SetDefaults

func (r *Route) SetDefaults(defaultTTL int)

type RouteEntity

type RouteEntity struct {
	Route           string `gorm:"not null; unique_index:idx_route" json:"route"`
	Port            uint16 `gorm:"not null; unique_index:idx_route" json:"port"`
	IP              string `gorm:"not null; unique_index:idx_route" json:"ip"`
	TTL             *int   `json:"ttl"`
	LogGuid         string `json:"log_guid"`
	RouteServiceUrl string `gorm:"not null; unique_index:idx_route" json:"route_service_url,omitempty"`
	ModificationTag `json:"modification_tag"`
}

type RouterGroup

type RouterGroup struct {
	Model
	Guid            string          `json:"guid"`
	Name            string          `json:"name"`
	Type            RouterGroupType `json:"type"`
	ReservablePorts ReservablePorts `json:"reservable_ports" yaml:"reservable_ports"`
}

func (RouterGroup) Validate

func (g RouterGroup) Validate() error

type RouterGroupDB

type RouterGroupDB struct {
	Model
	Name            string
	Type            string
	ReservablePorts string
}

func NewRouterGroupDB

func NewRouterGroupDB(routerGroup RouterGroup) RouterGroupDB

func (RouterGroupDB) TableName

func (RouterGroupDB) TableName() string

func (*RouterGroupDB) ToRouterGroup

func (rg *RouterGroupDB) ToRouterGroup() RouterGroup

type RouterGroupType

type RouterGroupType string
const (
	RouterGroup_TCP  RouterGroupType = "tcp"
	RouterGroup_HTTP RouterGroupType = "http"
)

type RouterGroups

type RouterGroups []RouterGroup

func (RouterGroups) Validate

func (g RouterGroups) Validate() error

type RouterGroupsDB

type RouterGroupsDB []RouterGroupDB

func (RouterGroupsDB) ToRouterGroups

func (rgs RouterGroupsDB) ToRouterGroups() RouterGroups

type TcpMappingEntity

type TcpMappingEntity struct {
	RouterGroupGuid  string  `gorm:"not null; unique_index:idx_tcp_route" json:"router_group_guid"`
	HostPort         uint16  `gorm:"not null; unique_index:idx_tcp_route; type:int" json:"backend_port"`
	HostIP           string  `gorm:"not null; unique_index:idx_tcp_route" json:"backend_ip"`
	SniHostname      *string `gorm:"default:null; unique_index:idx_tcp_route" json:"backend_sni_hostname,omitempty"`
	ExternalPort     uint16  `gorm:"not null; unique_index:idx_tcp_route; type: int" json:"port"`
	ModificationTag  `json:"modification_tag"`
	TTL              *int   `json:"ttl,omitempty"`
	IsolationSegment string `json:"isolation_segment"`
}

type TcpRouteMapping

type TcpRouteMapping struct {
	Model
	ExpiresAt time.Time `json:"-"`
	TcpMappingEntity
}

func NewSniTcpRouteMapping

func NewSniTcpRouteMapping(routerGroupGuid string, externalPort uint16, sniHostname *string, hostIP string, hostPort uint16, ttl int) TcpRouteMapping

func NewSniTcpRouteMappingWithModificationTag

func NewSniTcpRouteMappingWithModificationTag(
	routerGroupGuid string,
	externalPort uint16,
	sniHostname *string,
	hostIP string,
	hostPort uint16,
	ttl int,
	modTag ModificationTag,
) TcpRouteMapping

func NewTcpRouteMapping

func NewTcpRouteMapping(routerGroupGuid string, externalPort uint16, hostIP string, hostPort uint16, ttl int) TcpRouteMapping

func NewTcpRouteMappingWithModel

func NewTcpRouteMappingWithModel(tcpMapping TcpRouteMapping) (TcpRouteMapping, error)

func NewTcpRouteMappingWithModificationTag

func NewTcpRouteMappingWithModificationTag(
	routerGroupGuid string,
	externalPort uint16,
	hostIP string,
	hostPort uint16,
	ttl int,
	modTag ModificationTag,
) TcpRouteMapping

func (TcpRouteMapping) Matches

func (m TcpRouteMapping) Matches(other TcpRouteMapping) bool

func (*TcpRouteMapping) SetDefaults

func (t *TcpRouteMapping) SetDefaults(maxTTL int)

func (TcpRouteMapping) String

func (m TcpRouteMapping) String() string

func (TcpRouteMapping) TableName

func (TcpRouteMapping) TableName() string

Jump to

Keyboard shortcuts

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