go-ipset: github.com/aporeto-inc/go-ipset/ipset Index | Files

package ipset

import "github.com/aporeto-inc/go-ipset/ipset"

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

Index

Package Files

ipset.go

func DestroyAll Uses

func DestroyAll() error

DestroyAll is used to destroy the set.

func Swap Uses

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.

type IPSet Uses

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

IPSet implements an Interface to an set.

func New Uses

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

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

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

func (*IPSet) Add Uses

func (s *IPSet) Add(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 (*IPSet) AddOption Uses

func (s *IPSet) AddOption(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 (*IPSet) Del Uses

func (s *IPSet) Del(entry string) error

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

func (*IPSet) Destroy Uses

func (s *IPSet) Destroy() error

Destroy is used to destroy the set.

func (*IPSet) Flush Uses

func (s *IPSet) Flush() error

Flush is used to flush all entries in the set.

func (*IPSet) List Uses

func (s *IPSet) List() ([]string, error)

List is used to show the contents of a set

func (*IPSet) Refresh Uses

func (s *IPSet) Refresh(entries []string) error

Refresh is used to to overwrite the set with the specified entries. The ipset is updated on the fly by hot swapping it with a temporary set.

func (*IPSet) Test Uses

func (s *IPSet) Test(entry string) (bool, error)

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

type Params Uses

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

Params defines optional parameters for creating a new set.

Package ipset imports 8 packages (graph) and is imported by 5 packages. Updated 2018-10-27. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).