ipset

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ipset is a library providing a wrapper to the IPtables ipset userspace utility

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(setName, entry string, timeout int) error

Add is used to add the specified entry to the set. A timeout of 0 means that the entry will be stored permanently in the set.

func AddOption

func AddOption(setName, entry string, option string, timeout int) error

AddOption is used to add the specified entry to the set. A timeout of 0 means that the entry will be stored permanently in the set.

func Del

func Del(setName, entry string) error

Del is used to delete the specified entry from the set.

func Destroy

func Destroy(setName string) error

Destroy is used to destroy the set.

func DestroyAll

func DestroyAll() error

DestroyAll is used to destroy the set.

func Flush

func Flush(setName string) error

Flush is used to flush all entries in the set.

func Init added in v1.0.1

func Init() error

func List

func List(setName string) ([]string, error)

List is used to show the contents of a set

func New

func New(name string, hashtype string, p *Params) error

New creates a new set and returns an Interface to it. Example:

testIpset := ipset.New("test", "hash:ip", &ipset.Params{})

func Refresh

func Refresh(setName string, entries []string) error

func Swap

func Swap(from, to string) error

Swap is used to hot swap two sets on-the-fly. Use with names of existing sets of the same type.

func Test

func Test(setName, entry string) (bool, error)

Test is used to check whether the specified entry is in the set or not.

Types

type IPSet

type IPSet struct {
	Name       string
	HashType   string
	HashFamily string
	HashSize   int
	MaxElem    int
	Timeout    int
}

IPSet implements an Interface to an set.

type Params

type Params struct {
	HashFamily string
	HashSize   int
	MaxElem    int
	Timeout    int
}

Params defines optional parameters for creating a new set.

Jump to

Keyboard shortcuts

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