portcache

package
v10.298.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortCache

type PortCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PortCache is a generic cache of port pairs or exact ports. It can store and do lookups of ports on exact matches or ranges. It returns the stored values

func NewPortCache

func NewPortCache(name string) *PortCache

NewPortCache creates a new port cache

func (*PortCache) AddPortSpec

func (p *PortCache) AddPortSpec(s *portspec.PortSpec)

AddPortSpec adds a port spec into the cache

func (*PortCache) AddPortSpecToEnd

func (p *PortCache) AddPortSpecToEnd(s *portspec.PortSpec)

AddPortSpecToEnd adds a range at the end of the cache

func (*PortCache) AddUnique

func (p *PortCache) AddUnique(s *portspec.PortSpec) error

AddUnique adds a port spec into the cache and makes sure its unique

func (*PortCache) GetAllSpecValueFromPort

func (p *PortCache) GetAllSpecValueFromPort(port uint16) ([]interface{}, error)

GetAllSpecValueFromPort will return all the specs that potentially match. This will allow for overlapping ranges

func (*PortCache) GetSpecValueFromPort

func (p *PortCache) GetSpecValueFromPort(port uint16) (interface{}, error)

GetSpecValueFromPort searches the cache for a match based on a port It will return the first match found on exact ports or on the ranges of ports. If there are multiple intervals that match it will randomly return one of them.

func (*PortCache) Remove

func (p *PortCache) Remove(s *portspec.PortSpec) error

Remove will remove a port from the cache

func (*PortCache) RemoveStringPorts

func (p *PortCache) RemoveStringPorts(ports string) error

RemoveStringPorts will remove a port from the cache

Jump to

Keyboard shortcuts

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