trireme-lib: go.aporeto.io/trireme-lib/utils/portcache Index | Files

package portcache

import "go.aporeto.io/trireme-lib/utils/portcache"

Index

Package Files

portcache.go

type PortCache Uses

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 Uses

func NewPortCache(name string) *PortCache

NewPortCache creates a new port cache

func (*PortCache) AddPortSpec Uses

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

AddPortSpec adds a port spec into the cache

func (*PortCache) AddPortSpecToEnd Uses

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

AddPortSpecToEnd adds a range at the end of the cache

func (*PortCache) AddUnique Uses

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

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

func (*PortCache) GetAllSpecValueFromPort Uses

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 Uses

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 Uses

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

Remove will remove a port from the cache

func (*PortCache) RemoveStringPorts Uses

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

RemoveStringPorts will remove a port from the cache

Package portcache imports 4 packages (graph) and is imported by 3 packages. Updated 2018-11-15. Refresh now. Tools for package owners.