Documentation ¶
Overview ¶
Package corerad implements package main logic for the CoreRAD server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Advertiser ¶
type Advertiser struct { // OnInconsistentRA is an optional hook that fires when a router advertisement // is received that is inconsistent with the configuration being served by // this Advertiser, resulting in potential problems for clients. ours is // the RA generated by this Advertiser, and theirs is the RA received from // a remote router. If OnInconsistentRA is nil, the hook is not fired. OnInconsistentRA func(ours, theirs *ndp.RouterAdvertisement) // contains filtered or unexported fields }
An Advertiser sends NDP router advertisements.
func NewAdvertiser ¶
func NewAdvertiser( cctx *Context, cfg config.Interface, dialer *system.Dialer, watchC <-chan netstate.Change, terminate func() bool, ) *Advertiser
NewAdvertiser creates an Advertiser for the specified interface. If ll is nil, logs are discarded. If mm is nil, metrics are discarded.
func (*Advertiser) Ready ¶ added in v0.2.7
func (a *Advertiser) Ready() <-chan struct{}
Ready implements Task.
func (*Advertiser) Run ¶ added in v0.2.7
func (a *Advertiser) Run(ctx context.Context) error
Run initializes the configured interface and begins router solicitation and advertisement handling. Run will block until ctx is canceled or an error occurs.
func (*Advertiser) String ¶ added in v0.2.7
func (a *Advertiser) String() string
String implements Task.
type Context ¶ added in v0.2.8
type Context struct {
// contains filtered or unexported fields
}
A Context carries application context and telemetry throughout the Server and its Tasks.
type Metrics ¶ added in v0.2.3
type Metrics struct { // General server metrics. Info metricslite.Gauge Time metricslite.Gauge // Shared per-advertiser/monitor metrics. MessagesReceivedInvalidTotal metricslite.Counter // Per-advertiser metrics. AdvLastMulticastTime metricslite.Gauge AdvMessagesReceivedTotal metricslite.Counter AdvRouterAdvertisementInconsistenciesTotal metricslite.Counter AdvRouterAdvertisementsTotal metricslite.Counter AdvErrorsTotal metricslite.Counter // Per-monitor metrics. MonMessagesReceivedTotal metricslite.Counter MonFlagManaged metricslite.Gauge MonFlagOther metricslite.Gauge MonDefaultRouteExpirationTime metricslite.Gauge MonPrefixAutonomous metricslite.Gauge MonPrefixOnLink metricslite.Gauge MonPrefixPreferredLifetimeExpirationTime metricslite.Gauge MonPrefixValidLifetimeExpirationTime metricslite.Gauge // contains filtered or unexported fields }
Metrics contains metrics for a CoreRAD instance.
func NewMetrics ¶ added in v0.2.3
func NewMetrics( m metricslite.Interface, version string, buildTime time.Time, state system.State, ifis []config.Interface, ) *Metrics
NewMetrics produces a Metrics structure which will register its metrics to the specified metricslite.Interface. If m is nil, metrics are discarded.
type Monitor ¶ added in v0.2.6
type Monitor struct { // OnMessage is an optional callback which will fire when the monitor // receives an NDP message. OnMessage func(m ndp.Message) // contains filtered or unexported fields }
A Monitor listens and reports on NDP traffic.
func NewMonitor ¶ added in v0.2.6
func NewMonitor( cctx *Context, iface string, dialer *system.Dialer, watchC <-chan netstate.Change, verbose bool, ) *Monitor
NewMonitor creates a Monitor for the specified interface. If ll is nil, logs are discarded. If mm is nil, metrics are discarded.
func (*Monitor) Ready ¶ added in v0.2.7
func (m *Monitor) Ready() <-chan struct{}
Ready implements Task.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A Server coordinates the goroutines that handle various pieces of the CoreRAD server.
func NewServer ¶
NewServer creates a Server with the input configuration and logger. If ll is nil, logs are discarded.
func (*Server) BuildTasks ¶ added in v0.2.7
BuildTasks produces Tasks for the Server to run from the input configuration and termination check function. terminate reports whether the process should expect to be terminated and stopped or immediately reloaded by a supervision daemon.
type Task ¶ added in v0.2.7
type Task interface { // Run runs the Task until ctx is canceled or an error occurs. If ctx is // canceled, the Task should consume that error internally and return nil. Run(ctx context.Context) error // Ready indicates if a Task has been fully initialized once. Ready() <-chan struct{} // String returns information about a Task. fmt.Stringer }
A Task is a Server-owned task which will run until the input context is canceled.