qdr

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionIn  string = "in"
	DirectionOut string = "out"
)
View Source
const (
	HttpVersion1 string = "HTTP1"
	HttpVersion2        = "HTTP2"
)
View Source
const (
	DistributionBalanced  Distribution = "balanced"
	DistributionMulticast              = "multicast"
	DistributionClosest                = "closest"
)
View Source
const (
	VersionProperty string = "version"
)

Variables

This section is empty.

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 GetRouterConfigForHeadlessProxy

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

func GetSiteNameForGateway

func GetSiteNameForGateway(gateway *Router) string

func MarshalRouterConfig

func MarshalRouterConfig(config RouterConfig) (string, error)

func RouterConfigEquals

func RouterConfigEquals(actual, desired string) bool

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 *tls.Config) (*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) GetHttpRequestInfo

func (a *Agent) GetHttpRequestInfo(routers []Router) ([][]HttpRequestInfo, 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) GetLocalHttpConnectors

func (a *Agent) GetLocalHttpConnectors(filter HttpEndpointFilter) ([]HttpEndpoint, error)

func (*Agent) GetLocalHttpListeners

func (a *Agent) GetLocalHttpListeners(filter HttpEndpointFilter) ([]HttpEndpoint, error)

func (*Agent) GetLocalHttpRequestInfo

func (a *Agent) GetLocalHttpRequestInfo() ([]HttpRequestInfo, 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) 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) 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 *tls.Config) *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
	HttpListeners  HttpEndpointMap
	HttpConnectors HttpEndpointMap
}

func GetBridgeConfigFromConfigMap

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

func NewBridgeConfig

func NewBridgeConfig() BridgeConfig

func NewBridgeConfigCopy

func NewBridgeConfigCopy(src BridgeConfig) BridgeConfig

func (*BridgeConfig) AddHttpConnector

func (bc *BridgeConfig) AddHttpConnector(e HttpEndpoint)

func (*BridgeConfig) AddHttpListener

func (bc *BridgeConfig) AddHttpListener(e HttpEndpoint)

func (*BridgeConfig) AddTcpConnector

func (bc *BridgeConfig) AddTcpConnector(e TcpEndpoint)

func (*BridgeConfig) AddTcpListener

func (bc *BridgeConfig) AddTcpListener(e TcpEndpoint)

func (*BridgeConfig) Difference

func (*BridgeConfig) RemoveHttpConnector

func (bc *BridgeConfig) RemoveHttpConnector(name string) (bool, HttpEndpoint)

func (*BridgeConfig) RemoveHttpListener

func (bc *BridgeConfig) RemoveHttpListener(name string) (bool, HttpEndpoint)

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
	HttpListeners      HttpEndpointDifference
	HttpConnectors     HttpEndpointDifference
	AddedSslProfiles   []string
	DeletedSSlProfiles []string
}

func (*BridgeConfigDifference) Empty

func (a *BridgeConfigDifference) Empty() bool

func (*BridgeConfigDifference) Print

func (a *BridgeConfigDifference) Print()

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"`
}

type ConnectionFactory

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

func NewConnectionFactory

func NewConnectionFactory(url string, config *tls.Config) *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 HttpEndpoint

type HttpEndpoint 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"`
	ProtocolVersion string `json:"protocolVersion,omitempty"`
	Aggregation     string `json:"aggregation,omitempty"`
	EventChannel    bool   `json:"eventChannel,omitempty"`
	HostOverride    string `json:"hostOverride,omitempty"`
	SslProfile      string `json:"sslProfile,omitempty"`
	VerifyHostname  *bool  `json:"verifyHostname,omitempty"`
}

func GetHttpConnectors

func GetHttpConnectors(bridges []BridgeConfig) []HttpEndpoint

func GetHttpListeners

func GetHttpListeners(bridges []BridgeConfig) []HttpEndpoint

func (HttpEndpoint) Equivalent

func (a HttpEndpoint) Equivalent(b HttpEndpoint) bool

type HttpEndpointDifference

type HttpEndpointDifference struct {
	Deleted []HttpEndpoint
	Added   []HttpEndpoint
}

func (*HttpEndpointDifference) Empty

func (a *HttpEndpointDifference) Empty() bool

type HttpEndpointFilter

type HttpEndpointFilter func(*HttpEndpoint) bool

type HttpEndpointMap

type HttpEndpointMap map[string]HttpEndpoint

func (HttpEndpointMap) Difference

type HttpRequestInfo

type HttpRequestInfo struct {
	Name       string         `json:"name"`
	Host       string         `json:"host"`
	Address    string         `json:"address"`
	Site       string         `json:"site"`
	Direction  string         `json:"direction"`
	Requests   int            `json:"requests"`
	BytesIn    int            `json:"bytesIn"`
	BytesOut   int            `json:"bytesOut"`
	MaxLatency int            `json:"maxLatency"`
	Details    map[string]int `json:"details"`
}

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 (*Listener) SetMaxFrameSize

func (l *Listener) SetMaxFrameSize(value int)

func (*Listener) SetMaxSessionFrames

func (l *Listener) SetMaxSessionFrames(value int)

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 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
const (
	RoleInterRouter Role = "inter-router"
	RoleEdge             = "edge"
)

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
	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)

func (*RouterConfig) AddHttpConnector

func (r *RouterConfig) AddHttpConnector(e HttpEndpoint)

func (*RouterConfig) AddHttpListener

func (r *RouterConfig) AddHttpListener(e HttpEndpoint)

func (*RouterConfig) AddListener

func (r *RouterConfig) AddListener(l Listener)

func (*RouterConfig) AddSimpleSslProfile

func (r *RouterConfig) AddSimpleSslProfile(s SslProfile)

func (*RouterConfig) AddSimpleSslProfileWithPath

func (r *RouterConfig) AddSimpleSslProfileWithPath(path string, s SslProfile)

func (*RouterConfig) AddSslProfile

func (r *RouterConfig) AddSslProfile(s SslProfile)

func (*RouterConfig) AddSslProfileWithPath

func (r *RouterConfig) AddSslProfileWithPath(path string, s SslProfile)

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) 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) RemoveHttpConnector

func (r *RouterConfig) RemoveHttpConnector(name string) (bool, HttpEndpoint)

func (*RouterConfig) RemoveHttpListener

func (r *RouterConfig) RemoveHttpListener(name string) (bool, HttpEndpoint)

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) 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) 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 RouterMetadata

type RouterMetadata struct {
	Id                 string `json:"id,omitempty"`
	Mode               Mode   `json:"mode,omitempty"`
	HelloMaxAgeSeconds string `json:"helloMaxAgeSeconds,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"`
}

type SiteMetadata

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

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"`
}

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"`
}

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

Jump to

Keyboard shortcuts

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