qdr

package
v0.0.0-...-9d4b2c1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DirectionIn  string = "in"
	DirectionOut string = "out"
)
View Source
const (
	RoleInterRouter Role = "inter-router"
	RoleEdge             = "edge"
	RoleNormal           = "normal"
	RoleDefault          = ""
)
View Source
const (
	DistributionBalanced  Distribution = "balanced"
	DistributionMulticast              = "multicast"
	DistributionClosest                = "closest"
)
View Source
const SSL_PROFILE_PATH = "/etc/skupper-router-certs"
View Source
const (
	VersionProperty string = "version"
)

Variables

View Source
var LoggingLevels []string = []string{
	"trace",
	"debug",
	"info",
	"notice",
	"warning",
	"error",
	"critical",
	"trace+",
	"debug+",
	"info+",
	"notice+",
	"warning+",
	"error+",
	"critical+",
}
View Source
var LoggingModules []string = []string{
	"",
	"ROUTER",
	"ROUTER_CORE",
	"ROUTER_HELLO",
	"ROUTER_LS",
	"ROUTER_MA",
	"MESSAGE",
	"SERVER",
	"AGENT",
	"AUTHSERVICE",
	"CONTAINER",
	"ERROR",
	"POLICY",
	"HTTP",
	"CONN_MGR",
	"PYTHON",
	"PROTOCOL",
	"TCP_ADAPTOR",
	"HTTP_ADAPTOR",
	"DEFAULT",
}

Functions

func AsConfigMapData

func AsConfigMapData(config string) map[string]string

func AsInt

func AsInt(value interface{}) (int, bool)

func AsUint64

func AsUint64(value interface{}) (uint64, bool)

func ConfigureRouterLogging

func ConfigureRouterLogging(routerConfig *RouterConfig, logConfig []types.RouterLogConfig) bool

func ConnectedSitesInfo

func ConnectedSitesInfo(selfId string, routers []Router) types.TransportConnectedSites

func FilterListeners

func FilterListeners(in map[string]Listener, predicate ListenerPredicate) map[string]Listener
func GetInteriorAddressForUplink(connections []Connection) (string, error)

func GetLinkStatus

func GetLinkStatus(s *corev1.Secret, edge bool, connections []Connection) types.LinkStatus

func GetRouterAddress

func GetRouterAddress(id string, edge bool) string

func GetRouterAgentAddress

func GetRouterAgentAddress(id string, edge bool) string

func GetRouterConfigForHeadlessProxy

func GetRouterConfigForHeadlessProxy(definition types.ServiceInterface, siteId string, version string, namespace string, profilePath string) (string, error)

func GetRouterLogging

func GetRouterLogging(routerConfig *RouterConfig) []types.RouterLogConfig

func GetSiteNameForGateway

func GetSiteNameForGateway(gateway *Router) string

func IsNotNormalListener

func IsNotNormalListener(l Listener) bool

func MarshalRouterConfig

func MarshalRouterConfig(config RouterConfig) (string, error)

func ParseRouterLogConfig

func ParseRouterLogConfig(config string) ([]types.RouterLogConfig, error)

func RouterConfigEquals

func RouterConfigEquals(actual, desired string) bool

func RouterLogConfigToString

func RouterLogConfigToString(config []types.RouterLogConfig) string

func SkmanageCreateCommand

func SkmanageCreateCommand(entityType, name string, entity interface{}) []string

func SkmanageDeleteCommand

func SkmanageDeleteCommand(entityType, name string) []string

func SkmanageQueryCommand

func SkmanageQueryCommand(entityType, routerId string, edge bool, name string) []string

Types

type AddedSslProfiles

type AddedSslProfiles []string

type Address

type Address struct {
	Prefix       string `json:"prefix,omitempty"`
	Distribution string `json:"distribution,omitempty"`
}

type Agent

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

func Connect

func Connect(url string, config TlsConfigRetriever) (*Agent, error)

func (*Agent) BatchQuery

func (a *Agent) BatchQuery(queries []Query) ([][]Record, error)

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) Create

func (a *Agent) Create(typename string, name string, attributes map[string]interface{}) error

func (*Agent) CreateSslProfile

func (a *Agent) CreateSslProfile(profile SslProfile) error

func (*Agent) Delete

func (a *Agent) Delete(typename string, name string) error

func (*Agent) GetAllRouters

func (a *Agent) GetAllRouters() ([]Router, error)

func (*Agent) GetBridges

func (a *Agent) GetBridges(routers []Router) ([]BridgeConfig, error)

func (*Agent) GetConnections

func (a *Agent) GetConnections() ([]Connection, error)

func (*Agent) GetConnectionsFor

func (a *Agent) GetConnectionsFor(agent string) ([]Connection, error)

func (*Agent) GetConnectorByName

func (a *Agent) GetConnectorByName(name string) (*Connector, error)

func (*Agent) GetInteriorNodes

func (a *Agent) GetInteriorNodes() ([]RouterNode, error)

func (*Agent) GetLocalBridgeConfig

func (a *Agent) GetLocalBridgeConfig() (*BridgeConfig, error)

func (*Agent) GetLocalConnectorStatus

func (a *Agent) GetLocalConnectorStatus() (map[string]ConnectorStatus, error)

func (*Agent) GetLocalConnectors

func (a *Agent) GetLocalConnectors() (map[string]Connector, error)

func (*Agent) GetLocalGateways

func (a *Agent) GetLocalGateways() ([]Router, error)

func (*Agent) GetLocalListeners

func (a *Agent) GetLocalListeners() (map[string]Listener, error)

func (*Agent) GetLocalRouter

func (a *Agent) GetLocalRouter() (*Router, error)

func (*Agent) GetLocalTcpConnections

func (a *Agent) GetLocalTcpConnections() ([]TcpConnection, error)

func (*Agent) GetLocalTcpConnectors

func (a *Agent) GetLocalTcpConnectors(filter TcpEndpointFilter) ([]TcpEndpoint, error)

func (*Agent) GetLocalTcpListeners

func (a *Agent) GetLocalTcpListeners(filter TcpEndpointFilter) ([]TcpEndpoint, error)

func (*Agent) GetSslProfileByName

func (a *Agent) GetSslProfileByName(name string) (*SslProfile, error)

func (*Agent) GetSslProfiles

func (a *Agent) GetSslProfiles() (map[string]SslProfile, error)

func (*Agent) GetTcpConnections

func (a *Agent) GetTcpConnections(routers []Router) ([][]TcpConnection, error)

func (*Agent) Query

func (a *Agent) Query(typename string, attributes []string) ([]Record, error)

func (*Agent) QueryByAgentAddress

func (a *Agent) QueryByAgentAddress(typename string, attributes []string, agent string) ([]Record, error)

func (*Agent) QueryRouterNode

func (a *Agent) QueryRouterNode(typename string, attributes []string, node *RouterNode) ([]Record, error)

func (*Agent) Request

func (a *Agent) Request(request *Request) (*Response, error)

func (*Agent) UpdateConnectorConfig

func (a *Agent) UpdateConnectorConfig(changes *ConnectorDifference) error

func (*Agent) UpdateListenerConfig

func (a *Agent) UpdateListenerConfig(changes *ListenerDifference) error

func (*Agent) UpdateLocalBridgeConfig

func (a *Agent) UpdateLocalBridgeConfig(changes *BridgeConfigDifference) error

type AgentPool

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

func NewAgentPool

func NewAgentPool(url string, config TlsConfigRetriever) *AgentPool

func (*AgentPool) Get

func (p *AgentPool) Get() (*Agent, error)

func (*AgentPool) Put

func (p *AgentPool) Put(a *Agent)

type AmqpConnection

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

func (*AmqpConnection) Close

func (c *AmqpConnection) Close()

func (*AmqpConnection) Receiver

func (c *AmqpConnection) Receiver(address string, credit uint32) (messaging.Receiver, error)

func (*AmqpConnection) Sender

func (c *AmqpConnection) Sender(address string) (messaging.Sender, error)

type AmqpReceiver

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

func (*AmqpReceiver) Accept

func (s *AmqpReceiver) Accept(msg *amqp.Message) error

func (*AmqpReceiver) Close

func (s *AmqpReceiver) Close() error

func (*AmqpReceiver) Receive

func (s *AmqpReceiver) Receive() (*amqp.Message, error)

type AmqpSender

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

func (*AmqpSender) Close

func (s *AmqpSender) Close() error

func (*AmqpSender) Send

func (s *AmqpSender) Send(msg *amqp.Message) error

type BridgeConfig

type BridgeConfig struct {
	TcpListeners  TcpEndpointMap
	TcpConnectors TcpEndpointMap
}

func GetBridgeConfigFromConfigMap

func GetBridgeConfigFromConfigMap(configmap *corev1.ConfigMap) (*BridgeConfig, error)

func NewBridgeConfig

func NewBridgeConfig() BridgeConfig

func NewBridgeConfigCopy

func NewBridgeConfigCopy(src BridgeConfig) BridgeConfig

func (*BridgeConfig) AddTcpConnector

func (bc *BridgeConfig) AddTcpConnector(e TcpEndpoint)

func (*BridgeConfig) AddTcpListener

func (bc *BridgeConfig) AddTcpListener(e TcpEndpoint)

func (*BridgeConfig) Difference

func (*BridgeConfig) RemoveTcpConnector

func (bc *BridgeConfig) RemoveTcpConnector(name string) (bool, TcpEndpoint)

func (*BridgeConfig) RemoveTcpListener

func (bc *BridgeConfig) RemoveTcpListener(name string) (bool, TcpEndpoint)

func (*BridgeConfig) UpdateConfigMap

func (b *BridgeConfig) UpdateConfigMap(configmap *corev1.ConfigMap) (bool, error)

type BridgeConfigDifference

type BridgeConfigDifference struct {
	TcpListeners       TcpEndpointDifference
	TcpConnectors      TcpEndpointDifference
	AddedSslProfiles   []string
	DeletedSSlProfiles []string
}

func (*BridgeConfigDifference) Empty

func (a *BridgeConfigDifference) Empty() bool

func (*BridgeConfigDifference) Print

func (a *BridgeConfigDifference) Print()

type ConfigUpdate

type ConfigUpdate interface {
	Apply(config *RouterConfig) bool
}

type Connection

type Connection struct {
	Container  string `json:"container"`
	OperStatus string `json:"operStatus"`
	Host       string `json:"host"`
	Role       string `json:"role"`
	Active     bool   `json:"active"`
	Dir        string `json:"dir"`
}

func GetInterRouterOrEdgeConnection

func GetInterRouterOrEdgeConnection(host string, connections []Connection) *Connection

type ConnectionFactory

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

func NewConnectionFactory

func NewConnectionFactory(url string, config TlsConfigRetriever) *ConnectionFactory

func (*ConnectionFactory) Connect

func (f *ConnectionFactory) Connect() (messaging.Connection, error)

func (*ConnectionFactory) Url

func (f *ConnectionFactory) Url() string

type Connector

type Connector struct {
	Name             string `json:"name,omitempty"`
	Role             Role   `json:"role,omitempty"`
	Host             string `json:"host"`
	Port             string `json:"port"`
	RouteContainer   bool   `json:"routeContainer,omitempty"`
	Cost             int32  `json:"cost,omitempty"`
	VerifyHostname   bool   `json:"verifyHostname,omitempty"`
	SslProfile       string `json:"sslProfile,omitempty"`
	LinkCapacity     int32  `json:"linkCapacity,omitempty"`
	MaxFrameSize     int    `json:"maxFrameSize,omitempty"`
	MaxSessionFrames int    `json:"maxSessionFrames,omitempty"`
}

func (*Connector) SetMaxFrameSize

func (c *Connector) SetMaxFrameSize(value int)

func (*Connector) SetMaxSessionFrames

func (c *Connector) SetMaxSessionFrames(value int)

type ConnectorDifference

type ConnectorDifference struct {
	Deleted          []Connector
	Added            []Connector
	AddedSslProfiles map[string]SslProfile
}

func ConnectorsDifference

func ConnectorsDifference(actual map[string]Connector, desired *RouterConfig, ignorePrefix *string) *ConnectorDifference

func (*ConnectorDifference) Empty

func (a *ConnectorDifference) Empty() bool

type ConnectorStatus

type ConnectorStatus struct {
	Name        string
	Host        string
	Port        string
	Role        string
	Cost        int
	Status      string
	Description string
}

type DeletedSslProfiles

type DeletedSslProfiles []string

type Distribution

type Distribution string

type Listener

type Listener struct {
	Name             string `json:"name,omitempty" yaml:"name,omitempty"`
	Role             Role   `json:"role,omitempty" yaml:"role,omitempty"`
	Host             string `json:"host,omitempty" yaml:"host,omitempty"`
	Port             int32  `json:"port" yaml:"port,omitempty"`
	RouteContainer   bool   `json:"routeContainer,omitempty" yaml:"route-container,omitempty"`
	Http             bool   `json:"http,omitempty" yaml:"http,omitempty"`
	Cost             int32  `json:"cost,omitempty" yaml:"cost,omitempty"`
	SslProfile       string `json:"sslProfile,omitempty" yaml:"ssl-profile,omitempty"`
	SaslMechanisms   string `json:"saslMechanisms,omitempty" yaml:"sasl-mechanisms,omitempty"`
	AuthenticatePeer bool   `json:"authenticatePeer,omitempty" yaml:"authenticate-peer,omitempty"`
	LinkCapacity     int32  `json:"linkCapacity,omitempty" yaml:"link-capacity,omitempty"`
	HttpRootDir      string `json:"httpRootDir,omitempty" yaml:"http-rootdir,omitempty"`
	Websockets       bool   `json:"websockets,omitempty" yaml:"web-sockets,omitempty"`
	Healthz          bool   `json:"healthz,omitempty" yaml:"healthz,omitempty"`
	Metrics          bool   `json:"metrics,omitempty" yaml:"metrics,omitempty"`
	MaxFrameSize     int    `json:"maxFrameSize,omitempty" yaml:"max-frame-size,omitempty"`
	MaxSessionFrames int    `json:"maxSessionFrames,omitempty" yaml:"max-session-frames,omitempty"`
}

func EdgeListener

func EdgeListener(options types.RouterOptions) Listener

func InteriorListener

func InteriorListener(options types.RouterOptions) Listener

func (Listener) Equivalent

func (desired Listener) Equivalent(actual Listener) bool

func (*Listener) SetMaxFrameSize

func (l *Listener) SetMaxFrameSize(value int)

func (*Listener) SetMaxSessionFrames

func (l *Listener) SetMaxSessionFrames(value int)

type ListenerDifference

type ListenerDifference struct {
	Deleted []Listener
	Added   []Listener
}

func ListenersDifference

func ListenersDifference(actual map[string]Listener, desired map[string]Listener) *ListenerDifference

func (*ListenerDifference) Empty

func (a *ListenerDifference) Empty() bool

type ListenerPredicate

type ListenerPredicate func(Listener) bool

type LogConfig

type LogConfig struct {
	Module string `json:"module"`
	Enable string `json:"enable"`
}

type Mode

type Mode string
const (
	ModeInterior Mode = "interior"
	ModeEdge          = "edge"
)

type PortMapping

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

func RecoverPortMapping

func RecoverPortMapping(config *RouterConfig) *PortMapping

func (*PortMapping) GetPortForKey

func (p *PortMapping) GetPortForKey(key string) (int, error)

func (*PortMapping) ReleasePortForKey

func (p *PortMapping) ReleasePortForKey(key string)

type Query

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

type Record

type Record map[string]interface{}

func (Record) AsBool

func (r Record) AsBool(field string) bool

func (Record) AsInt

func (r Record) AsInt(field string) int

func (Record) AsRecord

func (r Record) AsRecord(field string) Record

func (Record) AsString

func (r Record) AsString(field string) string

func (Record) AsUint64

func (r Record) AsUint64(field string) uint64

type Request

type Request struct {
	Address    string
	Type       string
	Version    string
	Properties map[string]interface{}
	Body       string
}

type RequestResponse

type RequestResponse interface {
	Request(request *Request) (*Response, error)
}

type RequestServer

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

func NewRequestServer

func NewRequestServer(address string, handler RequestResponse, pool *AgentPool) *RequestServer

func (*RequestServer) Run

func (s *RequestServer) Run(ctx context.Context) error

type Response

type Response struct {
	Type       string
	Version    string
	Properties map[string]interface{}
	Body       string
}

type Role

type Role string

func GetRole

func GetRole(name string) Role

type Router

type Router struct {
	Id          string
	Address     string
	Edge        bool
	Site        SiteMetadata
	Version     string
	ConnectedTo []string
}

func GetRoutersForSite

func GetRoutersForSite(routers []Router, siteId string) []Router

func (*Router) IsGateway

func (r *Router) IsGateway() bool

type RouterConfig

type RouterConfig struct {
	Metadata    RouterMetadata
	SslProfiles map[string]SslProfile
	Listeners   map[string]Listener
	Connectors  map[string]Connector
	Addresses   map[string]Address
	LogConfig   map[string]LogConfig
	SiteConfig  *SiteConfig
	Bridges     BridgeConfig
}

func GetRouterConfigFromConfigMap

func GetRouterConfigFromConfigMap(configmap *corev1.ConfigMap) (*RouterConfig, error)

func InitialConfig

func InitialConfig(id string, siteId string, version string, edge bool, helloAge int) RouterConfig

func UnmarshalRouterConfig

func UnmarshalRouterConfig(config string) (RouterConfig, error)

func (*RouterConfig) AddAddress

func (r *RouterConfig) AddAddress(a Address)

func (*RouterConfig) AddConnector

func (r *RouterConfig) AddConnector(c Connector) bool

func (*RouterConfig) AddHealthAndMetricsListener

func (r *RouterConfig) AddHealthAndMetricsListener(port int32)

func (*RouterConfig) AddListener

func (r *RouterConfig) AddListener(l Listener) bool

func (*RouterConfig) AddSslProfile

func (r *RouterConfig) AddSslProfile(s SslProfile) bool

func (*RouterConfig) AddTcpConnector

func (r *RouterConfig) AddTcpConnector(e TcpEndpoint)

func (*RouterConfig) AddTcpListener

func (r *RouterConfig) AddTcpListener(e TcpEndpoint)

func (*RouterConfig) AsConfigMapData

func (r *RouterConfig) AsConfigMapData() (map[string]string, error)

func (*RouterConfig) GetMatchingListeners

func (config *RouterConfig) GetMatchingListeners(predicate ListenerPredicate) map[string]Listener

func (*RouterConfig) GetSiteMetadata

func (r *RouterConfig) GetSiteMetadata() SiteMetadata

func (*RouterConfig) IsEdge

func (r *RouterConfig) IsEdge() bool

func (*RouterConfig) RemoveConnector

func (r *RouterConfig) RemoveConnector(name string) (bool, Connector)

func (*RouterConfig) RemoveListener

func (r *RouterConfig) RemoveListener(name string) (bool, Listener)

func (*RouterConfig) RemoveSslProfile

func (r *RouterConfig) RemoveSslProfile(name string) bool

func (*RouterConfig) RemoveTcpConnector

func (r *RouterConfig) RemoveTcpConnector(name string) (bool, TcpEndpoint)

func (*RouterConfig) RemoveTcpListener

func (r *RouterConfig) RemoveTcpListener(name string) (bool, TcpEndpoint)

func (*RouterConfig) RemoveUnreferencedSslProfiles

func (r *RouterConfig) RemoveUnreferencedSslProfiles() bool

func (*RouterConfig) SetLogLevel

func (r *RouterConfig) SetLogLevel(module string, level string) bool

func (*RouterConfig) SetLogLevels

func (r *RouterConfig) SetLogLevels(levels map[string]string) bool

func (*RouterConfig) SetSiteMetadata

func (r *RouterConfig) SetSiteMetadata(site *SiteMetadata)

func (*RouterConfig) UnreferencedSslProfiles

func (r *RouterConfig) UnreferencedSslProfiles() map[string]SslProfile

func (*RouterConfig) UpdateBridgeConfig

func (r *RouterConfig) UpdateBridgeConfig(desired BridgeConfig) bool

func (*RouterConfig) UpdateConfigMap

func (r *RouterConfig) UpdateConfigMap(configmap *corev1.ConfigMap) (bool, error)

func (*RouterConfig) WriteToConfigMap

func (r *RouterConfig) WriteToConfigMap(configmap *corev1.ConfigMap) error

type RouterConfigHandler

type RouterConfigHandler interface {
	GetRouterConfig() (*RouterConfig, error)
	SaveRouterConfig(*RouterConfig) error
	RemoveRouterConfig() error
}

type RouterMetadata

type RouterMetadata struct {
	Id                  string `json:"id,omitempty"`
	Mode                Mode   `json:"mode,omitempty"`
	HelloMaxAgeSeconds  string `json:"helloMaxAgeSeconds,omitempty"`
	DataConnectionCount string `json:"dataConnectionCount,omitempty"`
	Metadata            string `json:"metadata,omitempty"`
}

type RouterNode

type RouterNode struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	NextHop string `json:"nextHop"`
	Address string `json:"address"`
}

func (*RouterNode) AsRouter

func (node *RouterNode) AsRouter() *Router

func (*RouterNode) IsSelf

func (r *RouterNode) IsSelf() bool

type SiteConfig

type SiteConfig struct {
	Name      string `json:"name,omitempty"`
	Location  string `json:"location,omitempty"`
	Provider  string `json:"provider,omitempty"`
	Platform  string `json:"platform,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

type SiteMetadata

type SiteMetadata struct {
	Id       string `json:"id,omitempty"`
	Version  string `json:"version,omitempty"`
	Platform string `json:"platform,omitempty"`
}

func GetSiteMetadata

func GetSiteMetadata(metadata string) SiteMetadata

type SslProfile

type SslProfile struct {
	Name           string `json:"name,omitempty"`
	CertFile       string `json:"certFile,omitempty"`
	PrivateKeyFile string `json:"privateKeyFile,omitempty"`
	CaCertFile     string `json:"caCertFile,omitempty"`
}

func ConfigureSslProfile

func ConfigureSslProfile(name string, path string, clientAuth bool) SslProfile

type TcpConnection

type TcpConnection struct {
	Name      string `json:"name"`
	Host      string `json:"host"`
	Address   string `json:"address"`
	Direction string `json:"direction"`
	BytesIn   int    `json:"bytesIn"`
	BytesOut  int    `json:"bytesOut"`
	Uptime    uint64 `json:"uptimeSeconds"`
	LastIn    uint64 `json:"lastInSeconds"`
	LastOut   uint64 `json:"lastOutSeconds"`
}

type TcpEndpoint

type TcpEndpoint struct {
	Name           string `json:"name,omitempty"`
	Host           string `json:"host,omitempty"`
	Port           string `json:"port,omitempty"`
	Address        string `json:"address,omitempty"`
	SiteId         string `json:"siteId,omitempty"`
	SslProfile     string `json:"sslProfile,omitempty"`
	VerifyHostname *bool  `json:"verifyHostname,omitempty"`
	ProcessID      string `json:"processId,omitempty"`
}

func GetTcpConnectors

func GetTcpConnectors(bridges []BridgeConfig) []TcpEndpoint

func (TcpEndpoint) Equivalent

func (a TcpEndpoint) Equivalent(b TcpEndpoint) bool

type TcpEndpointDifference

type TcpEndpointDifference struct {
	Deleted []string
	Added   []TcpEndpoint
}

func (*TcpEndpointDifference) Empty

func (a *TcpEndpointDifference) Empty() bool

type TcpEndpointFilter

type TcpEndpointFilter func(*TcpEndpoint) bool

type TcpEndpointMap

type TcpEndpointMap map[string]TcpEndpoint

func (TcpEndpointMap) Difference

type TlsConfigRetriever

type TlsConfigRetriever interface {
	GetTlsConfig() (*tls.Config, error)
}

Jump to

Keyboard shortcuts

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