acl

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 21 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 ACLModule

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

ACLModule is a control-plane component for ACL (Access Control List) module.

func NewACLModule

func NewACLModule(cfg *Config, options ...ModuleOption) (*ACLModule, error)

NewACLModule creates a new ACL module instance.

func (*ACLModule) Close

func (m *ACLModule) Close() error

func (*ACLModule) Endpoint

func (m *ACLModule) Endpoint() string

func (*ACLModule) Name

func (m *ACLModule) Name() string

func (*ACLModule) RegisterService

func (m *ACLModule) RegisterService(server *grpc.Server)

func (*ACLModule) ServicesNames

func (m *ACLModule) ServicesNames() []string

func (*ACLModule) UnaryServerInterceptors

func (m *ACLModule) UnaryServerInterceptors() []grpc.UnaryServerInterceptor

UnaryServerInterceptors returns the gRPC unary interceptors for this module.

type ACLService

type ACLService struct {
	aclpb.UnimplementedACLServiceServer
	// contains filtered or unexported fields
}

ACLService implements the gRPC ACL service.

func NewACLService

func NewACLService(backend Backend, options ...Option) *ACLService

NewACLService creates an ACL gRPC service backed by the given Backend.

func (*ACLService) DeleteConfig

func (*ACLService) DrainMetricsReads

func (m *ACLService) DrainMetricsReads()

DrainMetricsReads blocks until every in-flight metrics collection has finished.

A collection outlives the request handlers that joined it, so the shared memory it reads may only be released after this returns.

func (*ACLService) GetRulesCounters

GetRulesCounters returns the per-rule counters of the named config, or of every config when the request names none.

The counters come from the same merged read the rule metrics scrape uses, so the two requests never read the family concurrently. Counters whose packets and bytes are both zero across all workers are omitted, matching the metrics read.

func (*ACLService) ListConfigs

func (*ACLService) Metrics

func (m *ACLService) Metrics(ctx context.Context, tags ...*commonpb.MetricTag) ([]*commonpb.Metric, error)

Metrics returns ACL module metrics matching tags: per-pipeline packet counters, ACL compilation info, and gRPC call metrics.

Concurrent scrapes are coalesced into one shared collection of the per-position packet-counter reads, and every concurrent caller receives the same values filtered by its own tags.

Per-rule counters are served by RuleMetrics and GetRulesCounters, not here. Counter metrics are omitted when all worker values are zero to reduce output noise.

Labels:

  • config: ACL config name (all counter metrics)
  • device: dataplane device name (all counter metrics)
  • pipeline: pipeline name (all counter metrics)
  • function: pipeline function name (all counter metrics)
  • chain: pipeline chain name (all counter metrics)
  • grpc_type: always "unary" (gRPC metrics)
  • grpc_service: fully-qualified gRPC service name (gRPC metrics)
  • grpc_method: RPC name (gRPC metrics)
  • grpc_code: gRPC status code string (grpc_server_handled_total only)

func (*ACLService) RuleMetrics

func (m *ACLService) RuleMetrics(ctx context.Context, req *aclpb.GetMetricsRulesRequest) ([]*commonpb.Metric, error)

RuleMetrics returns ACL per-rule counter metrics for the selected positions: one packets and one bytes counter for every rule counter.

One merged shared-memory read serves every selector: concurrent scrapes are coalesced into it, and selection of each caller's positions happens on its shared result.

These are the counters Metrics leaves out, read from the runtime-kind storages it never touches. An empty request field matches every value. One read serves every position, and each metric's position comes from the tags its counter group carries. Requests received over gRPC reject selector values the fixed-size counter-tag fields cannot carry. Counter metrics are omitted when all worker values are zero to reduce output noise.

Labels:

  • config: ACL config name
  • device: dataplane device name
  • pipeline: pipeline name
  • function: pipeline function name
  • chain: pipeline chain name
  • counter: rule counter name

func (*ACLService) ShowConfig

func (*ACLService) UnaryServerInterceptor

func (m *ACLService) UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor returns the service's gRPC metrics interceptor, or nil when metrics are not configured.

func (*ACLService) UpdateConfig

type Backend

type Backend interface {
	// NewModule allocates a new ACL module config in shared memory with
	// the ruleset compiled into it and the named fwstate-map objects
	// linked. The returned handle is not yet published to the dataplane.
	NewModule(
		name string,
		rules []cacl.ACLRule,
		fw4MapName, fw6MapName string,
	) (ModuleHandle, error)
	// UpdateModule publishes handle to dp_config_gen so the dataplane
	// picks it up on the next round.
	UpdateModule(handle ModuleHandle) error
	// DeleteModule removes a module config from the dataplane.
	DeleteModule(name string) error
	// DPConfig returns the dataplane configuration handle for counter
	// and position queries.
	DPConfig() *ffi.DPConfig
}

Backend abstracts shared-memory operations for the ACL service.

func NewBackend

func NewBackend(agent *ffi.Agent) Backend

NewBackend creates a Backend that operates on real shared memory.

type Config

type Config struct {
	ffi.AttachConfig `yaml:",inline"`

	// Endpoint is the gRPC endpoint address
	Endpoint xcfg.NonEmptyString `yaml:"endpoint"`
}

Config represents ACL module configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default configuration

func (*Config) Default

func (m *Config) Default()

Default resets Config to DefaultConfig.

type MetricsService

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

MetricsService exposes ACL module 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 ACL module metrics matching the request's tags.

func (*MetricsService) GetMetricsRules

GetMetricsRules returns the per-rule counter metrics GetMetrics leaves out.

type ModuleHandle

type ModuleHandle interface {
	Free() error
	AsFFIModule() ffi.ModuleConfig
	GetInfo() *cacl.ACLConfigInfo
}

ModuleHandle is a handle to an ACL module configuration written to shared memory. The handle is fully built at construction and never updated afterwards; Free releases it.

type ModuleOption

type ModuleOption func(*moduleOptions)

ModuleOption configures the ACLModule constructor.

func WithModuleLog

func WithModuleLog(log *zap.Logger) ModuleOption

WithModuleLog sets the logger for the ACL module.

type Option

type Option func(*options)

Option configures an ACLService.

func WithLog

func WithLog(log *zap.Logger) Option

WithLog sets the service logger.

func WithMetrics

func WithMetrics(factory grpcmetrics.Factory) Option

WithMetrics sets the gRPC metrics factory.

When unset, no metrics are collected.

Directories

Path Synopsis
aclpb
v1

Jump to

Keyboard shortcuts

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