Documentation
¶
Overview ¶
Package ipsm focus on ip set operation Copyright 2018 Microsoft. All rights reserved. MIT License
Index ¶
- type Ipset
- type IpsetManager
- func (ipsMgr *IpsetManager) AddToList(listName string, setName string) error
- func (ipsMgr *IpsetManager) AddToSet(setName, ip, spec, podKey string) error
- func (ipsMgr *IpsetManager) Clean() error
- func (ipsMgr *IpsetManager) CreateList(listName string) error
- func (ipsMgr *IpsetManager) CreateSet(setName string, spec []string) error
- func (ipsMgr *IpsetManager) DeleteFromList(listName string, setName string) error
- func (ipsMgr *IpsetManager) DeleteFromSet(setName, ip, podKey string) error
- func (ipsMgr *IpsetManager) DeleteList(listName string) error
- func (ipsMgr *IpsetManager) DeleteSet(setName string) error
- func (ipsMgr *IpsetManager) Destroy() error
- func (ipsMgr *IpsetManager) DestroyNpmIpsets() error
- func (ipsMgr *IpsetManager) Exists(listName string, setName string, kind string) bool
- func (ipsMgr *IpsetManager) IpSetReferIncOrDec(ipsetName string, kind string, countOperation ReferCountOperation)
- func (ipsMgr *IpsetManager) Run(entry *ipsEntry) (int, error)
- func (ipsMgr *IpsetManager) SetExists(setName string) (bool, string)
- type ReferCountOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ipset ¶
type Ipset struct {
// contains filtered or unexported fields
}
Ipset represents one ipset entry.
type IpsetManager ¶
type IpsetManager struct { ListMap map[string]*Ipset //tracks all set lists. SetMap map[string]*Ipset //label -> []ip // contains filtered or unexported fields }
IpsetManager stores ipset states.
func NewIpsetManager ¶
func NewIpsetManager(exec utilexec.Interface) *IpsetManager
NewIpsetManager creates a new instance for IpsetManager object.
func (*IpsetManager) AddToList ¶
func (ipsMgr *IpsetManager) AddToList(listName string, setName string) error
AddToList inserts an ipset to an ipset list.
func (*IpsetManager) AddToSet ¶
func (ipsMgr *IpsetManager) AddToSet(setName, ip, spec, podKey string) error
AddToSet inserts an ip to an entry in setMap, and creates/updates the corresponding ipset.
func (*IpsetManager) Clean ¶ added in v1.0.9
func (ipsMgr *IpsetManager) Clean() error
TODO this below function is to be extended while improving ipset refer count support, if not used, please remove this stale function. Clean removes all the empty sets & lists under the namespace.
func (*IpsetManager) CreateList ¶
func (ipsMgr *IpsetManager) CreateList(listName string) error
CreateList creates an ipset list. npm maintains one setlist per namespace label.
func (*IpsetManager) CreateSet ¶
func (ipsMgr *IpsetManager) CreateSet(setName string, spec []string) error
CreateSet creates an ipset.
func (*IpsetManager) DeleteFromList ¶
func (ipsMgr *IpsetManager) DeleteFromList(listName string, setName string) error
DeleteFromList removes an ipset to an ipset list.
func (*IpsetManager) DeleteFromSet ¶
func (ipsMgr *IpsetManager) DeleteFromSet(setName, ip, podKey string) error
DeleteFromSet removes an ip from an entry in setMap, and delete/update the corresponding ipset.
func (*IpsetManager) DeleteList ¶
func (ipsMgr *IpsetManager) DeleteList(listName string) error
DeleteList removes an ipset list.
func (*IpsetManager) DeleteSet ¶
func (ipsMgr *IpsetManager) DeleteSet(setName string) error
DeleteSet removes a set from ipset.
func (*IpsetManager) Destroy ¶ added in v1.0.9
func (ipsMgr *IpsetManager) Destroy() error
Destroy completely cleans ipset.
func (*IpsetManager) DestroyNpmIpsets ¶
func (ipsMgr *IpsetManager) DestroyNpmIpsets() error
DestroyNpmIpsets destroys only ipsets created by NPM
func (*IpsetManager) Exists ¶ added in v1.0.9
func (ipsMgr *IpsetManager) Exists(listName string, setName string, kind string) bool
Exists checks if an element exists in setMap/listMap.
func (*IpsetManager) IpSetReferIncOrDec ¶
func (ipsMgr *IpsetManager) IpSetReferIncOrDec(ipsetName string, kind string, countOperation ReferCountOperation)
IpSetReferIncOrDec checks if an element exists in setMap/listMap and then increases or decreases this referCount.
func (*IpsetManager) Run ¶ added in v1.0.9
func (ipsMgr *IpsetManager) Run(entry *ipsEntry) (int, error)
Run execute an ipset command to update ipset.
type ReferCountOperation ¶
type ReferCountOperation bool
ReferCountOperation is used to indicate whether ipset refer count should be increased or decreased.
const ( IncrementOp ReferCountOperation = true DecrementOp ReferCountOperation = false )