loxilib

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 15

README

sanity workflow

What is loxilib

loxilib is a standalone golang library providing utility and common functionality like trie-lpm, networking utils, counters, logging etc. Originally designed to work only with loxilb, it can now be used with any golang project.

Documentation

Index

Constants

View Source
const (
	TRIE_SUCCESS    = 0
	TRIE_ERR_GEN    = -1
	TRIE_ERR_EXISTS = -2
	TRIE_ERR_NOENT  = -3
	TRIE_ERR_NOMEM  = -4
	TRIE_ERR_UNK    = -5
	TRIE_ERR_PREFIX = -6
)
View Source
const (
	TRIE_JMP_LENGTH  = 8
	PREFIX_ARR_LEN   = (1 << (TRIE_JMP_LENGTH + 1)) - 1
	PREFIX_ARR_NBITS = ((PREFIX_ARR_LEN + TRIE_JMP_LENGTH) & ^TRIE_JMP_LENGTH) / TRIE_JMP_LENGTH
	PTR_ARR_LEN      = (1 << TRIE_JMP_LENGTH)
	PTR_ARR_NBITS    = ((PTR_ARR_LEN + TRIE_JMP_LENGTH) & ^TRIE_JMP_LENGTH) / TRIE_JMP_LENGTH
)

Variables

View Source
var (
	LogTTY       bool
	CurrLogLevel LogLevelT
	LogItEmer    *log.Logger
	LogItAlert   *log.Logger
	LogItCrit    *log.Logger
	LogItErr     *log.Logger
	LogItWarn    *log.Logger
	LogItNotice  *log.Logger
	LogItInfo    *log.Logger
	LogItDebug   *log.Logger
)

Functions

func Htonl

func Htonl(i uint32) uint32

func Htons

func Htons(i uint16) uint16

func HttpProber added in v0.9.0

func HttpProber(urls string) bool

func IPtonl

func IPtonl(ip net.IP) uint32

func L4ServiceProber

func L4ServiceProber(sType string, sName string) bool

func LogIt

func LogIt(l LogLevelT, format string, v ...interface{})

LogIt uses Printf format internally Arguments are considered in-line with fmt.Printf.

func LogItInit

func LogItInit(logFile string, logLevel LogLevelT, toTTY bool)

func NltoIP

func NltoIP(addr uint32) net.IP

func Ntohl

func Ntohl(i uint32) uint32

func Ntohs

func Ntohs(i uint16) uint16

Types

type Counter

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

func NewCounter

func NewCounter(begin int, length int) *Counter

func (*Counter) GetCounter

func (C *Counter) GetCounter() (int, error)

func (*Counter) Get_counter_p added in v0.9.0

func (C *Counter) Get_counter_p() (int, error)

func (*Counter) PutCounter

func (C *Counter) PutCounter(id int) error

func (*Counter) Put_counter_p added in v0.9.0

func (C *Counter) Put_counter_p(id int) error

type LogLevelT

type LogLevelT int
const (
	LOG_EMERG LogLevelT = iota
	LOG_ALERT
	LOG_CRITICAL
	LOG_ERROR
	LOG_WARNING
	LOG_NOTICE
	LOG_INFO
	LOG_DEBUG
)

type TrieData

type TrieData interface {
}

type TrieIterIntf

type TrieIterIntf interface {
	TrieNodeWalker(b string)
	TrieData2String(d TrieData) string
}

type TrieRoot

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

func TrieInit

func TrieInit(v6 bool) *TrieRoot

func (*TrieRoot) AddTrie

func (t *TrieRoot) AddTrie(cidr string, data TrieData) int

func (*TrieRoot) DelTrie

func (t *TrieRoot) DelTrie(cidr string) int

func (*TrieRoot) FindTrie

func (t *TrieRoot) FindTrie(IP string) (int, *net.IPNet, TrieData)

func (*TrieRoot) Trie2String

func (t *TrieRoot) Trie2String(tf TrieIterIntf)

Jump to

Keyboard shortcuts

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