ipsm

package
v1.6.14 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package ipsm focus on ip set operation Copyright 2018 Microsoft. All rights reserved. MIT License

Index

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 {
	sync.RWMutex
	// contains filtered or unexported fields
}

IpsetManager stores ipset states. Hold lock only exposed methods are called to avoid race condition from all controllers

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) AddToListNoLock

func (ipsMgr *IpsetManager) AddToListNoLock(listName, setName string) error

AddToListNoLock is identical to AddToList except it does not lock the ipsMgr.

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) AddToSetNoLock

func (ipsMgr *IpsetManager) AddToSetNoLock(setName, ip, spec, podKey string) error

AddToSetNoLock is identical to AddToSet except it does not lock the ipsMgr.

func (*IpsetManager) CreateList

func (ipsMgr *IpsetManager) CreateList(listName string) error

CreateList creates an ipset list. npm maintains one setlist per namespace label.

func (*IpsetManager) CreateListNoLock

func (ipsMgr *IpsetManager) CreateListNoLock(listName string) error

CreateListNoLock is identical to CreateList except it does not lock the ipsMgr.

func (*IpsetManager) CreateSet

func (ipsMgr *IpsetManager) CreateSet(setName string, spec []string) error

CreateSet creates an ipset.

func (*IpsetManager) CreateSetNoLock

func (ipsMgr *IpsetManager) CreateSetNoLock(setName string, spec []string) error

CreateSetNoLock is identical to CreateSet except it does not lock the ipsMgr.

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) DestroyNpmIpsets

func (ipsMgr *IpsetManager) DestroyNpmIpsets() error

DestroyNpmIpsets destroys only ipsets created by NPM

func (*IpsetManager) GetListMapRaw

func (ipsMgr *IpsetManager) GetListMapRaw() ([]byte, error)

func (*IpsetManager) GetSetMapRaw

func (ipsMgr *IpsetManager) GetSetMapRaw() ([]byte, error)

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.

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
)

Jump to

Keyboard shortcuts

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