forward

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Update builds a module config from the compiled rules and
	// publishes it to the dataplane.
	Update(name string, payload RuleSet) (crud.Handle, error)
	// Delete removes a module config.
	Delete(name string) error
	// ModuleCounters returns selected dataplane counters collected for a module config.
	// If counterNames is nil or empty, it returns all counters for the module config.
	ModuleCounters(name string, counterNames []string) []CounterView
}

Backend abstracts shared memory operations.

func NewBackend

func NewBackend(agent *ffi.Agent) Backend

NewBackend creates a Backend that operates on real shared memory.

type Config

type Config struct {
	modulebase.BaseConfig `yaml:",inline"`
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Default

func (m *Config) Default()

Default resets Config to DefaultConfig.

type CounterView

type CounterView struct {
	Device   string
	Pipeline string
	Function string
	Chain    string
	Name     string
	Values   [][]uint64
}

type ForwardModule

type ForwardModule struct {
	*modulebase.Base
}

ForwardModule is a control-plane component of a module that is responsible for forwarding traffic between devices.

func NewForwardModule

func NewForwardModule(cfg *Config, options ...Option) (*ForwardModule, error)

type ForwardService

type ForwardService struct {
	forwardpb.UnimplementedForwardServiceServer
	// contains filtered or unexported fields
}

func NewForwardService

func NewForwardService(backend Backend) *ForwardService

func (*ForwardService) DeleteConfig

func (*ForwardService) ListConfigs

func (*ForwardService) Metrics

func (m *ForwardService) Metrics(tags ...*commonpb.MetricTag) ([]*commonpb.Metric, error)

Metrics returns Forward per-rule metrics matching tags, collected from the dataplane.

func (*ForwardService) ShowConfig

func (*ForwardService) UpdateConfig

UpdateConfig replaces the rule set for a named forward module config and publishes it to the dataplane.

A rule that leaves its counter empty is stored with "to_" plus its target, bounded to the counter-name limit, so ShowConfig never returns an empty name for a rule applied here. A non-empty counter is passed through verbatim.

type MetricsService

type MetricsService struct {
	forwardpb.UnimplementedMetricsServiceServer
	// contains filtered or unexported fields
}

MetricsService exposes Forward module per-rule metrics over its own gRPC service.

func NewMetricsService

func NewMetricsService(source metricsSource) *MetricsService

NewMetricsService creates a MetricsService backed by source.

func (*MetricsService) GetMetrics

GetMetrics returns a snapshot of Forward per-rule metrics matching the request's tags.

type Option

type Option = modulebase.Option

Option configures the ForwardModule constructor.

func WithLog

func WithLog(log *zap.Logger) Option

WithLog sets the logger for the forward module.

type RuleSet added in v0.4.0

type RuleSet struct {
	// Rules is the rule document exactly as accepted, echoed by reads.
	Rules []*forwardpb.Rule
	// Compiled is the rule document in the representation shared memory
	// publishes.
	Compiled []cforward.ForwardRule
}

RuleSet is the published payload: the accepted rule document together with its shared-memory representation.

Directories

Path Synopsis
forwardpb
v1

Jump to

Keyboard shortcuts

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