ipset

package
v0.108.0-b.61 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package ipset provides ipset functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.107.53

type Config struct {
	// Logger is used for logging the operation of the ipset manager.  It must
	// not be nil.
	Logger *slog.Logger

	// Lines is the ipset configuration with the following syntax:
	//
	//	DOMAIN[,DOMAIN].../IPSET_NAME[,IPSET_NAME]...
	//
	// Lines must not contain any blank lines or comments.
	Lines []string
}

Config is the configuration structure for the ipset manager.

type Manager

type Manager interface {
	Add(ctx context.Context, host string, ip4s, ip6s []net.IP) (n int, err error)
	Close() (err error)
}

Manager is the ipset manager interface.

TODO(a.garipov): Perhaps generalize this into some kind of a NetFilter type, since ipset is exclusive to Linux?

func NewManager

func NewManager(ctx context.Context, conf *Config) (mgr Manager, err error)

NewManager returns a new ipset manager. IPv4 addresses are added to an ipset with an ipv4 family; IPv6 addresses, to an ipv6 ipset. ipset must exist.

If conf.Lines is empty, mgr and err are nil. The error's chain contains errors.ErrUnsupported if current OS is not supported.

Jump to

Keyboard shortcuts

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