Documentation ¶
Index ¶
- Constants
- func ArpPing(DIP net.IP, SIP net.IP, ifName string) (int, error)
- func CountAllSetBitsInArr(arr []uint8) int
- func CountSetBitsInArr(arr []uint8, bPos int) int
- func Debug(obj interface{})
- func HTTPProber(urls string) bool
- func Htonl(i uint32) uint32
- func Htons(i uint16) uint16
- func IPtonl(ip net.IP) uint32
- func IsBitSetInArr(arr []uint8, bPos int) bool
- func IsNetIPv4(address string) bool
- func IsNetIPv6(address string) bool
- func L4ServiceProber(sType string, sName string, sHint, req, resp string) bool
- func LogIt(l LogLevelT, format string, v ...interface{})
- func NetGetIfiStats(ifName string, ifs *IfiStat) int
- func NltoIP(addr uint32) net.IP
- func Ntohl(i uint32) uint32
- func Ntohs(i uint16) uint16
- func SetBitInArr(arr []uint8, bPos int)
- func UnSetBitInArr(arr []uint8, bPos int)
- type Counter
- type IfiStat
- type LogLevelT
- type Logger
- type TrieData
- type TrieIterIntf
- type TrieRoot
Constants ¶
const ( RxBytes = iota RxPkts RxErrors RxDrops RxFifo RxFrame RxComp RxMcast TxBytes TxPkts TxErrors TxDrops TxFifo TxColls TxCarr TxComp MaxSidx )
constants related to ifstats
const ( TrieSuccess = -iota TrieErrGeneric TrieErrExists TrieErrNoEnt TrieErrNoMem TrieErrUnknown TrieErrPrefix )
return codes
const ( TrieJmpLength = 8 PrefixArrLenfth = (1 << (TrieJmpLength + 1)) - 1 PrefixArrNbits = ((PrefixArrLenfth + TrieJmpLength) & ^TrieJmpLength) / TrieJmpLength PtrArrLength = (1 << TrieJmpLength) PtrArrNBits = ((PtrArrLength + TrieJmpLength) & ^TrieJmpLength) / TrieJmpLength )
constants
const (
OsIfStatFile = "/proc/net/dev"
)
Variables ¶
This section is empty.
Functions ¶
func CountAllSetBitsInArr ¶
CountAllSetBitsInArr - count set bits in an array of uint8
func CountSetBitsInArr ¶
CountSetBitsInArr - count set bits in an array of uint8 from bPos
func HTTPProber ¶
HTTPProber - Do a http probe for given url returns true/false depending on whether probing was successful
func IsBitSetInArr ¶
IsBitSetInArr - check given bPos bit is set in the array
func L4ServiceProber ¶
L4ServiceProber - Do a probe for L4 service end-points sType is "tcp" or "udp" or "sctp" sName is end-point IP address in string format sHint is source address hint if any req is the request to be made to server (empty for none) resp is the response expected from server (empty for none) returns true/false depending on whether probing was successful
func NetGetIfiStats ¶
NetGetIfiStats - Get OS statistics for a given interface
func UnSetBitInArr ¶
UnSetBitInArr - unset bPos bit in the array
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter - context container
func NewCounter ¶
NewCounter - Allocate a set of counters
func (*Counter) GetCounter ¶
GetCounter - Get next available counter
func (*Counter) PutCounter ¶
PutCounter - Return a counter to the available list
func (*Counter) ReserveCounter ¶
ReserveCounter - Don't allocate this counter
type Logger ¶
type Logger struct { 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 }
var (
DefaultLogger *Logger
)
func LogItInit ¶
LogItInit - Initialize the logger logFile - name of the logfile logLevel - specify current loglevel toTTY - specify if logs need to be redirected to TTY as well or not
func (*Logger) Log ¶
Log uses Printf format internally Arguments are considered in-line with fmt.Printf.
func (*Logger) LogItSetLevel ¶
LogItSetLevel - Set level of the logger
type TrieData ¶
type TrieData interface { }
TrieData - Any user data to be associated with a trie node
type TrieIterIntf ¶
TrieIterIntf - Interface implementation needed for trie users to traverse and convert data
type TrieRoot ¶
type TrieRoot struct {
// contains filtered or unexported fields
}
TrieRoot - root of a trie data structure
func (*TrieRoot) AddTrie ¶
AddTrie - Add a trie entry cidr is the route in cidr format and data is any user-defined data returns 0 on success or non-zero error code on error
func (*TrieRoot) DelTrie ¶
DelTrie - Delete a trie entry cidr is the route in cidr format returns 0 on success or non-zero error code on error
func (*TrieRoot) FindTrie ¶
FindTrie - Lookup matching route as per longest prefix match IP is the IP address in string format returns the following : 1. 0 on success or non-zero error code on error 2. matching route in *net.IPNet form 3. user-defined data associated with the trie entry
func (*TrieRoot) Trie2String ¶
func (t *TrieRoot) Trie2String(tf TrieIterIntf)
Trie2String - stringify the trie table