Documentation ¶
Overview ¶
Package ipset provides a basic wrapper to the ipset utility for IPTables. More information about ipset can be found at: http://ipset.netfilter.org/index.html
Index ¶
- type IPSet
- func (set *IPSet) Add(name string, entry string, options ...string) error
- func (set *IPSet) AddUnique(name, entry string, options ...string) error
- func (set *IPSet) Create(name string, typ string, options ...string) error
- func (set *IPSet) Delete(name string, entry string, options ...string) error
- func (set *IPSet) Destroy(name string) error
- func (set *IPSet) Flush(name string) error
- func (set *IPSet) GetReferences(name string) (int64, error)
- func (set *IPSet) List(name string, suppressMembers bool) (*Set, error)
- func (set *IPSet) ListEntries(name string) (entries []string, err error)
- func (set *IPSet) ListSetNames() (names []string, err error)
- func (set *IPSet) ListSets(suppressMembers bool) (sets []*Set, err error)
- func (set *IPSet) Refresh(name string, entries ...string) error
- func (set *IPSet) Rename(from string, to string) error
- func (set *IPSet) Restore(filename string) error
- func (set *IPSet) Save(name string, filename string) error
- func (set *IPSet) Swap(from string, to string) error
- func (set *IPSet) Test(name string, entry string, options ...string) error
- type Set
- type SetEntry
- type Sets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPSet ¶
type IPSet struct { Path string // contains filtered or unexported fields }
IPSet represents a ipset cmd executor.
func (*IPSet) AddUnique ¶
AddUnique adds a new entry to the named set, if it does not already exist.
func (*IPSet) Create ¶
Create creates a new ipset with a given name and type. For more on set types, please see: http://ipset.netfilter.org/ipset.man.html#lbAT. Additional options can be passed to the Create() command. These options must be passed in a sequential key, value order. For example, ipset.Create("test", "hash:ip", "timeout", "300") will add a new set with the timeout option set to a value of 300.
func (*IPSet) GetReferences ¶
GetReferences returns the named set's References
func (*IPSet) ListEntries ¶
ListEntries shows the entries of a named set.
func (*IPSet) ListSetNames ¶
ListSetNames returns a slice containing the name of each set.
type Set ¶
type Set struct { XMLName xml.Name `xml:"ipset"` Name string `xml:"name,attr"` Type string `xml:"type"` Revision string `xml:"revision"` Header struct { XMLName xml.Name `xml:"header"` Family string `xml:"family"` HashSize int64 `xml:"hashsize"` Maxelem int64 `xml:"maxelem"` MemSize int64 `xml:"memsize"` References int64 `xml:"references"` Numentries int64 `xml:"numentries"` } `xml:"header"` Members struct { XMLName xml.Name `xml:"members"` Members []*SetEntry `xml:"member"` } `xml:"members"` }
Set ...