admission

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 12 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

Overview

Package admission implements access control for incoming connections. Before a connection is handled, the admission controller checks whether the client's address is allowed to use the service.

The package provides:

  • NewAdmission: a local admission controller backed by IP/CIDR matchers, with optional periodic reload from file, Redis, or HTTP sources.
  • AdmissionGroup: composes multiple admission controllers; all must admit for the connection to proceed.
  • Plugin-based admission (gRPC and HTTP) in the plugin sub-package.
  • Connection wrappers in the wrapper sub-package that enforce admission checks per-read (for TCP) and per-packet (for UDP).

Matching modes:

  • Whitelist (whitelist=true): only addresses matching a rule are admitted.
  • Blacklist (whitelist=false): addresses matching a rule are denied; everything else is admitted. This is the default.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdmissionGroup added in v0.0.3

func AdmissionGroup(admissions ...admission.Admission) admission.Admission

AdmissionGroup creates a composite admission controller that requires every member to admit the address. If any member denies, the address is denied immediately (short-circuit evaluation).

Nil members are skipped.

func NewAdmission

func NewAdmission(opts ...Option) admission.Admission

NewAdmission creates a local admission controller with the given options. It starts a background goroutine that periodically reloads patterns from configured external sources (file, Redis, HTTP).

By default the controller operates in blacklist mode: any address matching the loaded patterns is denied. Use WhitelistOption(true) to invert this.

Types

type Option

type Option func(opts *options)

Option is a functional option for configuring an admission controller.

func FileLoaderOption

func FileLoaderOption(fileLoader loader.Loader) Option

FileLoaderOption sets the file-based pattern loader.

func HTTPLoaderOption

func HTTPLoaderOption(httpLoader loader.Loader) Option

HTTPLoaderOption sets the HTTP-based pattern loader.

func LoggerOption

func LoggerOption(logger logger.Logger) Option

LoggerOption sets the logger for the admission controller.

func MatchersOption

func MatchersOption(matchers []string) Option

MatchersOption sets static match patterns that are combined with dynamically loaded patterns on each reload. Patterns may be:

  • Bare IP addresses: "192.168.1.1", "::1"
  • CIDR networks: "10.0.0.0/8", "fd00::/8"
  • Hostnames: resolved to IP addresses via DNS

func RedisLoaderOption

func RedisLoaderOption(redisLoader loader.Loader) Option

RedisLoaderOption sets the Redis-based pattern loader.

func ReloadPeriodOption

func ReloadPeriodOption(period time.Duration) Option

ReloadPeriodOption sets the interval for automatically reloading patterns from external loaders (file, Redis, HTTP). A value <= 0 disables periodic reloading.

func WhitelistOption

func WhitelistOption(whitelist bool) Option

WhitelistOption sets whether the admission controller operates in whitelist mode. In whitelist mode, only addresses matching one or more rules are admitted; all others are denied.

Directories

Path Synopsis
Package admission implements gRPC-based admission plugins.
Package admission implements gRPC-based admission plugins.
Package wrapper provides net.Listener and net.Conn wrappers that enforce admission control at the network level.
Package wrapper provides net.Listener and net.Conn wrappers that enforce admission control at the network level.

Jump to

Keyboard shortcuts

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