router

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlagsCfgMapKey is used as a key in the source configuration map to pass flags from
	// higher levels (i.e. CLI arguments) down through the stack w/o colliding w/ file
	// based configuration values
	FlagsCfgMapKey = "@flags"

	// PathMapKey is used to store a loaded configuration file's source path
	PathMapKey = "@file"

	// CtrlMapKey is the string key for the ctrl section
	CtrlMapKey = "ctrl"

	// CtrlEndpointMapKey is the string key for the ctrl.endpoint section
	CtrlEndpointMapKey = "endpoint"

	// CtrlEndpointsMapKey is the string key for the ctrl.endpoints section
	CtrlEndpointsMapKey = "endpoints"

	// CtrlEndpointBindMapKey is the string key for the ctrl.bind section
	CtrlEndpointBindMapKey = "bind"

	// CtrlRateLimiterMinSizeValue is the minimum size that can be configured for the control channel rate limiter
	// window range
	CtrlRateLimiterMinSizeValue = 5

	// CtrlRateLimiterMaxSizeValue is the maximum size that can be configured for the control channel rate limiter
	// window range
	CtrlRateLimiterMaxSizeValue = 1000

	// CtrlRateLimiterMetricOutstandingCount is the name of the metric tracking how many tasks are in process
	CtrlRateLimiterMetricOutstandingCount = "ctrl_limiter.in_process"

	// CtrlRateLimiterMetricCurrentWindowSize is the name of the metric tracking the current window size
	CtrlRateLimiterMetricCurrentWindowSize = "ctrl_limiter.window_size"

	// CtrlRateLimiterMetricWorkTimer is the name of the metric tracking how long successful tasks are taking to complete
	CtrlRateLimiterMetricWorkTimer = "ctrl_limiter.work_timer"

	CtrlHaMapKey = "ha"
)
View Source
const (
	TimeFormatYear    = "2006"
	TimeFormatMonth   = "01"
	TimeFormatDay     = "02"
	TimeFormatHour    = "15"
	TimeFormatMinute  = "04"
	TimeFormatSeconds = "05"
	TimestampFormat   = TimeFormatYear + TimeFormatMonth + TimeFormatDay + TimeFormatHour + TimeFormatMinute + TimeFormatSeconds

	DefaultLinkHeartbeatSendInterval = 10 * time.Second
	DefaultLinkUnresponsiveTimeout   = time.Minute
)
View Source
const (
	AgentAppId byte = 2
)

Variables

This section is empty.

Functions

func LoadConfigMap

func LoadConfigMap(path string) (map[interface{}]interface{}, error)

func LoadIdentityConfigFromMap

func LoadIdentityConfigFromMap(cfgmap map[interface{}]interface{}) (*identity.Config, error)

func SetConfigMapFlags

func SetConfigMapFlags(cfgmap map[interface{}]interface{}, flags map[string]*pflag.Flag)

Types

type Config

type Config struct {
	Id             *identity.TokenId
	EnableDebugOps bool
	Forwarder      *forwarder.Options
	Trace          struct {
		Handler *channel.TraceHandler
	}
	Profile struct {
		Memory struct {
			Path     string
			Interval time.Duration
		}
		CPU struct {
			Path string
		}
	}
	Ctrl struct {
		InitialEndpoints      []*UpdatableAddress
		LocalBinding          string
		DefaultRequestTimeout time.Duration
		Options               *channel.Options
		DataDir               string
		Heartbeats            env.HeartbeatOptions
		StartupTimeout        time.Duration
		RateLimit             command.AdaptiveRateLimiterConfig
	}
	Link struct {
		Listeners  []map[interface{}]interface{}
		Dialers    []map[interface{}]interface{}
		Heartbeats channel.HeartbeatOptions
	}
	Dialers   map[string]xgress.OptionsData
	Listeners []listenerBinding
	Transport map[interface{}]interface{}
	Metrics   struct {
		ReportInterval       time.Duration
		IntervalAgeThreshold time.Duration
		MessageQueueSize     int
	}
	HealthChecks struct {
		CtrlPingCheck struct {
			Interval     time.Duration
			Timeout      time.Duration
			InitialDelay time.Duration
		}
		LinkCheck struct {
			MinLinks     int
			Interval     time.Duration
			InitialDelay time.Duration
		}
	}
	Ha struct {
		Enabled bool
	}
	Proxy   *transport.ProxyConfiguration
	Plugins []string
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) Configure

func (config *Config) Configure(sub config.Subconfig) error

func (*Config) CreateBackup

func (config *Config) CreateBackup() (string, error)

CreateBackup will attempt to use the current path value to create a backup of the file on disk. The resulting file path is returned.

func (*Config) CurrentCtrlAddress

func (config *Config) CurrentCtrlAddress() string

func (*Config) IsHaEnabled added in v1.1.1

func (config *Config) IsHaEnabled() bool

func (*Config) Save

func (config *Config) Save() error

Save attempts to take the current config's src attribute and Save it as yaml to the path value.

func (*Config) SetFlags

func (config *Config) SetFlags(flags map[string]*pflag.Flag)

func (*Config) UpdateControllerEndpoint

func (config *Config) UpdateControllerEndpoint(address string) error

UpdateControllerEndpoint updates the runtime configuration address of the controller and the internal map configuration.

type Router

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

func Create

func Create(config *Config, versionProvider versions.VersionProvider) *Router

func (*Router) DefaultRequestTimeout

func (self *Router) DefaultRequestTimeout() time.Duration

func (*Router) GetChannel

func (self *Router) GetChannel(controllerId string) channel.Channel

func (*Router) GetCloseNotify

func (self *Router) GetCloseNotify() <-chan struct{}

func (*Router) GetConfig

func (self *Router) GetConfig() *Config

func (*Router) GetCtrlRateLimiter added in v0.33.0

func (self *Router) GetCtrlRateLimiter() rate.AdaptiveRateLimitTracker

func (*Router) GetDialerCfg

func (self *Router) GetDialerCfg() map[string]xgress.OptionsData

func (*Router) GetHeartbeatOptions

func (self *Router) GetHeartbeatOptions() env.HeartbeatOptions

func (*Router) GetLinkDialerPool

func (self *Router) GetLinkDialerPool() goroutines.Pool

func (*Router) GetMetricsRegistry

func (self *Router) GetMetricsRegistry() metrics.UsageRegistry

func (*Router) GetNetworkControllers

func (self *Router) GetNetworkControllers() env.NetworkControllers

func (*Router) GetRateLimiterPool

func (self *Router) GetRateLimiterPool() goroutines.Pool

func (*Router) GetRouterDataModel added in v1.1.1

func (self *Router) GetRouterDataModel() *common.RouterDataModel

func (*Router) GetRouterId

func (self *Router) GetRouterId() *identity.TokenId

func (*Router) GetStateManager added in v1.1.1

func (self *Router) GetStateManager() state.Manager

func (*Router) GetTraceHandler

func (self *Router) GetTraceHandler() *channel.TraceHandler

func (*Router) GetVersionInfo

func (self *Router) GetVersionInfo() versions.VersionProvider

func (*Router) GetXlinkDialers

func (self *Router) GetXlinkDialers() []xlink.Dialer

func (*Router) GetXlinkRegistry

func (self *Router) GetXlinkRegistry() xlink.Registry

func (*Router) GetXrctrls

func (self *Router) GetXrctrls() []env.Xrctrl

func (*Router) HandleAgentAsyncOp

func (self *Router) HandleAgentAsyncOp(conn net.Conn) error

func (*Router) HandleAgentOp

func (self *Router) HandleAgentOp(conn net.Conn) error

func (*Router) IsHaEnabled added in v1.1.1

func (self *Router) IsHaEnabled() bool

func (*Router) RegisterAgentBindHandler

func (self *Router) RegisterAgentBindHandler(bindHandler channel.BindHandler)

func (*Router) RegisterAgentOp

func (self *Router) RegisterAgentOp(opId byte, f func(c *bufio.ReadWriter) error)

func (*Router) RegisterDefaultAgentOps

func (self *Router) RegisterDefaultAgentOps(debugEnabled bool)

func (*Router) RegisterXWebHandlerFactory

func (self *Router) RegisterXWebHandlerFactory(x xweb.ApiHandlerFactory) error

func (*Router) RegisterXrctrl

func (self *Router) RegisterXrctrl(x env.Xrctrl) error

func (*Router) RegisterXweb

func (self *Router) RegisterXweb(x xweb.Instance) error

func (*Router) RenderJsonConfig

func (self *Router) RenderJsonConfig() (string, error)

func (*Router) Run

func (self *Router) Run() error

func (*Router) Shutdown

func (self *Router) Shutdown() error

func (*Router) Start

func (self *Router) Start() error

func (*Router) UpdateCtrlEndpoints

func (self *Router) UpdateCtrlEndpoints(endpoints []string)

type RouterMonitor

type RouterMonitor interface {
	Monitor()
}

type UpdatableAddress

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

UpdatableAddress allows a single address to be passed to multiple channel implementations and be centrally updated in a thread safe manner.

func NewUpdatableAddress

func NewUpdatableAddress(address transport.Address) *UpdatableAddress

NewUpdatableAddress create a new *UpdatableAddress which implements transport.Address and allow thread safe updating of the internal address

func (*UpdatableAddress) Dial

func (c *UpdatableAddress) Dial(name string, i *identity.TokenId, timeout time.Duration, tcfg transport.Configuration) (transport.Conn, error)

Dial implements transport.Address.Dial

func (*UpdatableAddress) DialWithLocalBinding

func (c *UpdatableAddress) DialWithLocalBinding(name string, binding string, i *identity.TokenId, timeout time.Duration, tcfg transport.Configuration) (transport.Conn, error)

func (*UpdatableAddress) Listen

func (c *UpdatableAddress) Listen(name string, i *identity.TokenId, acceptF func(transport.Conn), tcfg transport.Configuration) (io.Closer, error)

Listen implements transport.Address.Listen

func (*UpdatableAddress) MarshalYAML

func (c *UpdatableAddress) MarshalYAML() (interface{}, error)

MarshalYAML handles serialization for the YAML format

func (*UpdatableAddress) MustListen

func (c *UpdatableAddress) MustListen(name string, i *identity.TokenId, acceptF func(transport.Conn), tcfg transport.Configuration) io.Closer

MustListen implements transport.Address.MustListen

func (*UpdatableAddress) Store

func (c *UpdatableAddress) Store(address transport.Address)

Store updates the address currently used by this configuration instance

func (*UpdatableAddress) String

func (c *UpdatableAddress) String() string

String implements transport.Address.String

func (*UpdatableAddress) Type

func (c *UpdatableAddress) Type() string

Type implements transport.Address.Type

func (*UpdatableAddress) UnmarshalYAML

func (c *UpdatableAddress) UnmarshalYAML(value *yaml3.Node) error

UnmarshalYAML handled deserialization for the YAML format

Jump to

Keyboard shortcuts

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