Documentation
¶
Index ¶
- Constants
- Variables
- func IP2String(ip []byte) string
- func IPAddOne(ip []byte) []byte
- func IPCompare(ip1, ip2 []byte) int
- func IPSubOne(ip []byte) []byte
- func LoadVectorIndexFromBuff(cBuff []byte) ([]byte, error)
- func ParseIP(ip string) ([]byte, error)
- type Header
- type IndexPolicy
- type Searcher
- type Version
Constants ¶
View Source
const ( Structure20 = 2 Structure30 = 3 HeaderInfoLength = 256 VectorIndexRows = 256 VectorIndexCols = 256 VectorIndexSize = 8 )
View Source
const ( IPv4VersionNo = 4 IPv6VersionNo = 6 )
Variables ¶
View Source
var ( IPvx = &Version{} IPv4 = &Version{ Id: IPv4VersionNo, Name: "IPv4", Bytes: 4, SegmentIndexSize: 14, IPCompare: func(ip1, ip2 []byte) int { ip2[0], ip2[3] = ip2[3], ip2[0] ip2[1], ip2[2] = ip2[2], ip2[1] return bytes.Compare(ip1, ip2) }, } IPv6 = &Version{ Id: IPv6VersionNo, Name: "IPv6", Bytes: 16, SegmentIndexSize: 38, IPCompare: func(ip1, ip2 []byte) int { return bytes.Compare(ip1, ip2) }, } )
Functions ¶
func IPCompare ¶
IPCompare compares two IP addresses Returns: -1 if ip1 < ip2, 0 if ip1 == ip2, 1 if ip1 > ip2
func LoadVectorIndexFromBuff ¶
Types ¶
type Header ¶
type Header struct {
// data []byte
Version uint16
IndexPolicy IndexPolicy
CreatedAt uint32
StartIndexPtr uint32
EndIndexPtr uint32
// since IPv6 supporting
IPVersion int
RuntimePtrBytes int
}
func LoadHeaderFromBuff ¶
LoadHeaderFromBuff wrap the header info from the content buffer
type IndexPolicy ¶
type IndexPolicy int
const ( VectorIndexPolicy IndexPolicy = 1 BTreeIndexPolicy IndexPolicy = 2 )
func (IndexPolicy) String ¶
func (i IndexPolicy) String() string
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
func NewSearcher ¶
func (*Searcher) GetIOCount ¶
GetIOCount return the global io count for the last search
type Version ¶
type Version struct {
Id int
Name string
Bytes int
SegmentIndexSize int
// function to compare two ips
IPCompare func([]byte, []byte) int
}
func VersionFromHeader ¶
func VersionFromIP ¶
func VersionFromName ¶
Click to show internal directories.
Click to hide internal directories.