Documentation ¶
Index ¶
Constants ¶
const ( IP_SIZE = 16 // TODO: optimize memory usage for ipv4 address HEADER_LEN = 32 MAX_LINE = 1000000 MAX_LOC_LEN = 1024 )
const (
IP_LENGTH = 16
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IPItems ¶
type IPItems struct { Version string // contains filtered or unexported fields }
IPItems manage single IP(hashSet) and ipPairs
func NewIPItems ¶
NewIPItems creates new IPItems
func (*IPItems) InsertPair ¶
InsertPair provides insert startIP,endIP into IpItems
func (*IPItems) InsertSingle ¶
InsertSingle insert single ip into ipitems
func (*IPItems) Sort ¶
func (ipItems *IPItems) Sort()
Sort provides for sorting dict according startIP by descending order
- Origin dict startIPStr endIPStr
------------------------ 10.26.74.55 10.26.74.255 10.12.14.2 10.12.14.50 10.21.34.5 10.23.77.100 10.23.77.88 10.23.77.240 ------------------------
- Sorted dict startIPStr endIPStr
------------------------ 10.26.74.55 10.26.74.255 10.23.77.88 10.23.77.240 10.21.34.5 10.23.77.100 10.12.14.2 10.12.14.50 ------------------------
- Merged sorted dict startIPStr endIPStr
------------------------ 10.26.74.55 10.26.74.255 10.21.34.5 10.23.77.240 10.12.14.2 10.12.14.50 0.0.0.0 0.0.0.0 ------------------------
- Dict after resliced startIPStr endIPStr
------------------------ 10.26.74.55 10.26.74.255 10.21.34.5 10.23.77.240 10.12.14.2 10.12.14.50 ------------------------
type IPTable ¶
type IPTable struct {
// contains filtered or unexported fields
}
func NewIPTable ¶
func NewIPTable() *IPTable
type IpLocationTable ¶
type IpLocationTable struct { Version string LocLen uint32 // contains filtered or unexported fields }
func NewIpLocationTable ¶
func NewIpLocationTable(maxSize uint32, LocLen uint32) (*IpLocationTable, error)