Documentation
¶
Index ¶
- Constants
- Variables
- func GetCity(n *NodeGeo) uint32
- func GetCountry(n *NodeGeo) uint32
- func GetRegion(n *NodeGeo) uint32
- func PackGeo(cnty []byte) uint32
- func PackIPAddr(ip net.IP) *[16]byte
- func UnpackGeo(pked uint32) *string
- type GeoTrees
- type NodeGeo
- type PatriciaError
- type StringTrees
- func (p *StringTrees) AddPrefix(addr string, content string)
- func (p *StringTrees) FindAllMatches(addr net.IP, len uint8) ([]string, error)
- func (p *StringTrees) FindBestMatch(addr uint32, addr6 []byte) (bool, string, error)
- func (p *StringTrees) RemovePrefix(addr string, content string) bool
- func (p *StringTrees) SetPrefix(addr string, content string)
- type Trees
- type Uint32Trees
Constants ¶
const (
FILE_CHECK_TIME = time.Hour
)
Variables ¶
Functions ¶
func GetCountry ¶
func PackIPAddr ¶
Types ¶
type GeoTrees ¶
type GeoTrees struct { Trees // contains filtered or unexported fields }
Geo tree only holds geo data
func (*GeoTrees) SearchBestFromHostGeo ¶
type PatriciaError ¶
type PatriciaError string
PatriciaError is used for errors using the sflow library. It implements the builtin error interface.
func (PatriciaError) Error ¶
func (err PatriciaError) Error() string
type StringTrees ¶
type StringTrees struct { Trees // contains filtered or unexported fields }
StringTrees is a IPv4/IPv6 pair of trees that hold string payloads
func NewStringTrees ¶
func NewStringTrees(log *logger.Logger) (*StringTrees, error)
NewStringTrees returns a new StringTrees
func (*StringTrees) AddPrefix ¶
func (p *StringTrees) AddPrefix(addr string, content string)
func (*StringTrees) FindAllMatches ¶
Finds all tags with the input address (relying on tree traversing behavior)
func (*StringTrees) FindBestMatch ¶
Finds the most-specific tag with the input address (relying on tree traversing behavior)
func (*StringTrees) RemovePrefix ¶
func (p *StringTrees) RemovePrefix(addr string, content string) bool
Always removes content at prefix - returns whether the delete removed any prefixes
func (*StringTrees) SetPrefix ¶
func (p *StringTrees) SetPrefix(addr string, content string)
Set the value for a prefix - overwrites what's there (technically, the first in the list)
type Trees ¶
type Trees struct { Length int // contains filtered or unexported fields }
Trees is a pair of IPv4/IPv6 patricia trees
type Uint32Trees ¶
type Uint32Trees struct { Trees // contains filtered or unexported fields }
PatriciaUin32 is a IPv4/IPv6 pair of trees that hold uint32 payloads
func NewUint32Trees ¶
NewUint32Trees returns a new Uint32Trees
func (*Uint32Trees) AddPrefix ¶
func (p *Uint32Trees) AddPrefix(addr string, content uint32)
func (*Uint32Trees) FindBestMatch ¶
Finds the most-specific tag with the input address (relying on tree traversing behavior)
func (*Uint32Trees) RemovePrefix ¶
func (p *Uint32Trees) RemovePrefix(addr string, content uint32) bool
Always removes content at prefix - returns whether the delete removed any prefixes