Documentation
¶
Overview ¶
*
- A minimalistic, memory size-savvy and fairly fast radix tree (AKA Patricia trie)
- implementation that uses IPv4 addresses with netmasks as keys and 32-bit signed
- integers as values. *
- This tree is generally uses in read-only manner: there are no key removal operation
- and the whole thing works best in pre-allocated fashion.
Index ¶
- Constants
- Variables
- func AtoU16(a []byte) uint16
- func EXTRACT(p, n, str uint32) uint32
- func EXTRACT8(p uint32, n uint8, str uint32) uint32
- func GETADR(node uint32) uint32
- func GETBRANCH(node uint32) uint32
- func GETSKIP(node uint32) uint32
- func IPv4Itoa(i uint32) string
- func ParseCIDR(s string) (ip, m uint32)
- func REMOVE(p, str uint32) uint32
- func RangeCIDR(s string) (uint32, uint32)
- func SETBRANCH(branch uint32) uint32
- func SETSKIP(skip uint32) uint32
- func Serialize(r *routingTable) (t, b, p []byte)
- func StoU16(a string) uint16
- func U16toS(u uint16) string
- type GeoIPFilter
- type GeoLite2Reader
Constants ¶
View Source
const ( GEO2_LOC_FILE = "GeoLite2-Country-Locations-en.csv" GEO2_IPV4_FILE = "GeoLite2-Country-Blocks-IPv4.csv" )
View Source
const ( NOPRE int32 = -1 /* an empty prefix pointer */ ADRSIZE = 32 U32ZERO uint32 = 0 MASK32 uint32 = 0xffffffff )
View Source
const UseNexthopCompression = false
Variables ¶
View Source
var ( ROOTBRANCH uint32 = 16 // The branching factor at the root FILLFACT float64 = 0.50 // The trie fill factor )
Functions ¶
Types ¶
type GeoIPFilter ¶
type GeoIPFilter struct {
// contains filtered or unexported fields
}
func NewGeoIPFilter ¶
func NewGeoIPFilter(keyword string) (f *GeoIPFilter, e error)
func (*GeoIPFilter) Filter ¶
func (f *GeoIPFilter) Filter(host string) bool
type GeoLite2Reader ¶
func (*GeoLite2Reader) Iter ¶
func (r *GeoLite2Reader) Iter(callback func(fields []string)) (e error)
func (*GeoLite2Reader) ReadEntries ¶
func (r *GeoLite2Reader) ReadEntries() (entries entrySet, e error)
for testing, update-geodb
func (*GeoLite2Reader) ReadToRoutingTable ¶
func (r *GeoLite2Reader) ReadToRoutingTable() *routingTable
for update-geodb
Click to show internal directories.
Click to hide internal directories.