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 ¶
- func AdmissionGroup(admissions ...admission.Admission) admission.Admission
- func NewAdmission(opts ...Option) admission.Admission
- type Option
- func FileLoaderOption(fileLoader loader.Loader) Option
- func HTTPLoaderOption(httpLoader loader.Loader) Option
- func LoggerOption(logger logger.Logger) Option
- func MatchersOption(matchers []string) Option
- func RedisLoaderOption(redisLoader loader.Loader) Option
- func ReloadPeriodOption(period time.Duration) Option
- func WhitelistOption(whitelist bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdmissionGroup ¶ added in v0.0.3
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 ¶
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 ¶
FileLoaderOption sets the file-based pattern loader.
func HTTPLoaderOption ¶
HTTPLoaderOption sets the HTTP-based pattern loader.
func LoggerOption ¶
LoggerOption sets the logger for the admission controller.
func MatchersOption ¶
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 ¶
RedisLoaderOption sets the Redis-based pattern loader.
func ReloadPeriodOption ¶
ReloadPeriodOption sets the interval for automatically reloading patterns from external loaders (file, Redis, HTTP). A value <= 0 disables periodic reloading.
func WhitelistOption ¶
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. |