Documentation ¶
Overview ¶
Package ipset is a library providing a wrapper to the IPtables ipset userspace utility
Index ¶
- Constants
- func DestroyAll(prefix string) error
- func Init(name string) error
- func Swap(from, to string) error
- type IPSet
- func (s *IPSet) Add(entry string, timeout int) error
- func (s *IPSet) AddOption(entry string, option string, timeout int) error
- func (s *IPSet) Del(entry string) error
- func (s *IPSet) Destroy() error
- func (s *IPSet) Flush() error
- func (s *IPSet) List() ([]string, error)
- func (s *IPSet) Refresh(entries []string) error
- func (s *IPSet) Test(entry string) (bool, error)
- type Params
Constants ¶
const (
AllSets = ""
)
Variables ¶
This section is empty.
Functions ¶
func DestroyAll ¶ added in v1.0.0
DestroyAll is used to destroy the set. The prefix may be a prefix string or the constant ipset.AllSets to specify that all existing sets should be destroyed Note that attempting to destroy a set that is in use will result in an error being returned.
I use the variadic form here to preserve the original API with no arguments. i.e. DestroyAll() with no arguments will still work.
DestroyAll("") and DestroyAll(ipset.AllSets) are equivalent to DestroyAll()
DestroyAll("prefix") is new functionality Note that the variadic allows for DestroyAll("prefix1", "prefix2") but all arguments after prefix1 are currently ignored
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.
func New ¶
New creates a new set and returns an Interface to it. Example:
testIpset := ipset.New("test", "hash:ip", &ipset.Params{})
func (*IPSet) Add ¶
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 ¶ added in v1.0.0
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.