ipsm

package
v0.0.0-...-2427888 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

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.

func NewIpset

func NewIpset(setName string) *Ipset

NewIpset creates a new instance for Ipset object.

type IpsetManager

type IpsetManager struct {
	// contains filtered or unexported fields
}

IpsetManager stores ipset states.

func NewIpsetManager

func NewIpsetManager() *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 string, ip string) error

AddToSet inserts an ip to an entry in setMap, and creates/updates the corresponding ipset.

func (*IpsetManager) Clean

func (ipsMgr *IpsetManager) Clean() error

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) 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 string, ip 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

func (ipsMgr *IpsetManager) Destroy() error

Destroy completely cleans ipset.

func (*IpsetManager) Exists

func (ipsMgr *IpsetManager) Exists(key string, val string, kind string) bool

Exists checks if an element exists in setMap/listMap.

func (*IpsetManager) Restore

func (ipsMgr *IpsetManager) Restore(configFile string) error

Restore restores ipset from file.

func (*IpsetManager) Run

func (ipsMgr *IpsetManager) Run(entry *ipsEntry) (int, error)

Run execute an ipset command to update ipset.

func (*IpsetManager) Save

func (ipsMgr *IpsetManager) Save(configFile string) error

Save saves ipset to file.

Jump to

Keyboard shortcuts

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