ipsets

package
v3.2.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPFamilyV4 = IPFamily("inet")
	IPFamilyV6 = IPFamily("inet6")
)
View Source
const MaxIPSetNameLength = 31

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedCloser

type BufferedCloser struct {
	BufWriter WriteFlusher
	Closer    io.Closer
}

func (*BufferedCloser) Close

func (b *BufferedCloser) Close() error

func (*BufferedCloser) Flush

func (b *BufferedCloser) Flush() error

func (*BufferedCloser) Write

func (b *BufferedCloser) Write(p []byte) (n int, err error)

type CmdIface

type CmdIface interface {
	StdinPipe() (WriteCloserFlusher, error)
	StdoutPipe() (io.ReadCloser, error)

	SetStdin(io.Reader)
	SetStdout(io.Writer)
	SetStderr(io.Writer)

	Start() error
	Wait() error
	Output() ([]byte, error)
	CombinedOutput() ([]byte, error)
}

type IPFamily

type IPFamily string

IPSetType constants for the names that the ipset command uses for the IP versions.

func (IPFamily) IsValid

func (f IPFamily) IsValid() bool

type IPSetMetadata

type IPSetMetadata struct {
	SetID   string
	Type    IPSetType
	MaxSize int
}

IPSetMetadata contains the metadata for a particular IP set, such as its name, type and size.

type IPSetType

type IPSetType string

IPSetType constants for the different kinds of IP set.

const (
	IPSetTypeHashIP     IPSetType = "hash:ip"
	IPSetTypeHashIPPort IPSetType = "hash:ip,port"
	IPSetTypeHashNet    IPSetType = "hash:net"
)

func (IPSetType) CanonicaliseMember

func (t IPSetType) CanonicaliseMember(member string) ipSetMember

CanonicaliseMember converts the string representation of an IP set member to a canonical object of some kind. The object is required to by hashable.

func (IPSetType) IsMemberIPV6

func (t IPSetType) IsMemberIPV6(member string) bool

func (IPSetType) IsValid

func (t IPSetType) IsValid() bool

func (IPSetType) SetType

func (t IPSetType) SetType() string

type IPSets

type IPSets struct {
	IPVersionConfig *IPVersionConfig
	// contains filtered or unexported fields
}

IPSets manages a whole "plane" of IP sets, i.e. all the IPv4 sets, or all the IPv6 IP sets.

func NewIPSets

func NewIPSets(ipVersionConfig *IPVersionConfig) *IPSets

func NewIPSetsWithShims

func NewIPSetsWithShims(
	ipVersionConfig *IPVersionConfig,
	cmdFactory cmdFactory,
	sleep func(time.Duration),
) *IPSets

NewIPSetsWithShims is an internal test constructor.

func (*IPSets) AddMembers

func (s *IPSets) AddMembers(setID string, newMembers []string)

AddMembers adds the given members to the IP set. Filters out members that are of the incorrect IP version.

func (*IPSets) AddOrReplaceIPSet

func (s *IPSets) AddOrReplaceIPSet(setMetadata IPSetMetadata, members []string)

AddOrReplaceIPSet queues up the creation (or replacement) of an IP set. After the next call to ApplyUpdates(), the IP sets will be replaced with the new contents and the set's metadata will be updated as appropriate.

func (*IPSets) ApplyDeletions

func (s *IPSets) ApplyDeletions()

ApplyDeletions tries to delete any IP sets that are no longer needed. Failures are ignored, deletions will be retried the next time we do a resync.

func (*IPSets) ApplyUpdates

func (s *IPSets) ApplyUpdates()

func (*IPSets) QueueResync

func (s *IPSets) QueueResync()

QueueResync forces a resync with the dataplane on the next ApplyUpdates() call.

func (*IPSets) RemoveIPSet

func (s *IPSets) RemoveIPSet(setID string)

RemoveIPSet queues up the removal of an IP set, it need not be empty. The IP sets will be removed on the next call to ApplyDeletions().

func (*IPSets) RemoveMembers

func (s *IPSets) RemoveMembers(setID string, removedMembers []string)

RemoveMembers queues up removal of the given members from an IP set. Members of the wrong IP version are ignored.

type IPVersionConfig

type IPVersionConfig struct {
	Family IPFamily
	// contains filtered or unexported fields
}

IPVersionConfig wraps up the metadata for a particular IP version. It can be used by this and other components to calculate IP set names from IP set IDs, for example.

func NewIPVersionConfig

func NewIPVersionConfig(
	family IPFamily,
	namePrefix string,
	allHistoricPrefixes []string,
	extraUnversionedIPSets []string,
) *IPVersionConfig

func (IPVersionConfig) IsTempIPSetName

func (c IPVersionConfig) IsTempIPSetName(setName string) bool

func (IPVersionConfig) NameForMainIPSet

func (c IPVersionConfig) NameForMainIPSet(setID string) string

NameForMainIPSet converts the given IP set ID (example: "qMt7iLlGDhvLnCjM0l9nzxbabcd"), to a name for use in the dataplane. The return value will have the configured prefix and is guaranteed to be short enough to use as an ipset name (example: "cali60s:qMt7iLlGDhvLnCjM0l9nzxb").

func (IPVersionConfig) NameForTempIPSet

func (c IPVersionConfig) NameForTempIPSet(n uint) string

func (IPVersionConfig) OwnsIPSet

func (c IPVersionConfig) OwnsIPSet(setName string) bool

OwnsIPSet returns true if the given IP set name appears to belong to Felix. i.e. whether it starts with an expected prefix.

type V4IPPort

type V4IPPort struct {
	IP       ip.V4Addr
	Port     uint16
	Protocol labelindex.IPSetPortProtocol
}

func (V4IPPort) String

func (p V4IPPort) String() string

type V6IPPort

type V6IPPort struct {
	IP       ip.V6Addr
	Port     uint16
	Protocol labelindex.IPSetPortProtocol
}

func (V6IPPort) String

func (p V6IPPort) String() string

type WriteCloserFlusher

type WriteCloserFlusher interface {
	io.WriteCloser
	Flush() error
}

type WriteFlusher

type WriteFlusher interface {
	io.Writer
	Flush() error
}

Jump to

Keyboard shortcuts

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