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 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) 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 IPAllocator
- func (ipa *IPAllocator) AddIPRange(cluster string, cidr string) error
- func (ipa *IPAllocator) AllocateNewIP(cluster string, cidr string, id uint32) (net.IP, error)
- func (ipa *IPAllocator) DeAllocateIP(cluster string, cidr string, id uint32, IPString string) error
- func (ipa *IPAllocator) DeleteIPRange(cluster string, cidr string) error
- type IPClusterPool
- type IPRange
- 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 (
IPClusterDefault = "default"
)
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" sName is end-point IP address in string format returns true/false depending on whether probing was successful
func NetGetIfiStats ¶ added in v0.7.7
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
type IPAllocator ¶ added in v0.8.0
type IPAllocator struct {
// contains filtered or unexported fields
}
IPAllocator - Main IP allocator context
func IpAllocatorNew ¶ added in v0.8.0
func IpAllocatorNew() *IPAllocator
IpAllocatorNew - Create a new allocator
func (*IPAllocator) AddIPRange ¶ added in v0.8.0
func (ipa *IPAllocator) AddIPRange(cluster string, cidr string) error
AddIPRange - Add a new IP Range for allocation in a cluster
func (*IPAllocator) AllocateNewIP ¶ added in v0.8.0
AllocateNewIP - Allocate a New IP address from the given cluster and CIDR range If id is 0, a new IP address will be allocated else IP addresses will be shared and it will be same as the first IP address allocted for this range
func (*IPAllocator) DeAllocateIP ¶ added in v0.8.0
DeAllocateIP - Deallocate the IP address from the given cluster and CIDR range
func (*IPAllocator) DeleteIPRange ¶ added in v0.8.0
func (ipa *IPAllocator) DeleteIPRange(cluster string, cidr string) error
DeleteIPRange - Delete a IP Range from allocation in a cluster
type IPClusterPool ¶ added in v0.8.0
type IPClusterPool struct {
// contains filtered or unexported fields
}
IPClusterPool - Holds IP ranges for a cluster
type IPRange ¶ added in v0.8.0
type IPRange struct {
// contains filtered or unexported fields
}
IPRange - Defines an IPRange
type Logger ¶ added in v0.7.9
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 ¶ added in v0.7.9
Log uses Printf format internally Arguments are considered in-line with fmt.Printf.
func (*Logger) LogItSetLevel ¶ added in v0.7.9
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