corerad

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package corerad implements package main logic for the CoreRAD server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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(iface string, cfg config.Interface, ll *log.Logger, mm *Metrics) *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) Advertise

func (a *Advertiser) Advertise(ctx context.Context, watchC <-chan netstate.Change) error

Advertise initializes the configured interface and begins router solicitation and advertisement handling. Advertise will block until ctx is canceled or an error occurs.

Before calling Advertise, call Events and ensure that the returned channel is being drained, or Advertiser will stop processing.

type Metrics added in v0.2.3

type Metrics struct {
	// General server metrics.
	Info metricslite.Gauge
	Time metricslite.Gauge

	// Per-advertiser metrics.
	LastMulticastTime                       metricslite.Gauge
	MessagesReceivedTotal                   metricslite.Counter
	MessagesReceivedInvalidTotal            metricslite.Counter
	RouterAdvertisementInconsistenciesTotal metricslite.Counter
	RouterAdvertisementsTotal               metricslite.Counter
	ErrorsTotal                             metricslite.Counter
	// contains filtered or unexported fields
}

Metrics contains metrics for a CoreRAD instance.

func NewMetrics added in v0.2.3

func NewMetrics(m metricslite.Interface, 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.

func (*Metrics) Series added in v0.2.4

func (m *Metrics) Series() (map[string]metricslite.Series, bool)

Series produces a set of output timeseries from the Metrics, assuming the Metrics were initialized with a compatible metricslite.Interface. If not, Series will return nil, false.

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

func NewServer(cfg config.Config, ll *log.Logger) *Server

NewServer creates a Server with the input configuration and logger. If ll is nil, logs are discarded.

func (*Server) Ready

func (s *Server) Ready() <-chan struct{}

Ready indicates that the server is ready to begin serving requests.

func (*Server) Run

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

Run runs the corerad server until the context is canceled.

Jump to

Keyboard shortcuts

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