package
2.2.0+incompatible
Repository: https://github.com/ljkiraly/sdk.git
Documentation: pkg.go.dev

# README

ippool.IPPool

It is a red–black tree containing IPv4/IPv6 address networks. IP address represents as two uint64 numbers (high and low 64 bits of 128 bit IPv6 address). Each node of RB tree is bounds of IP range.

Performance

Performance results for IPPool, RoaringBitmap and PrefixPool. Each iteration pulls P2P address pair for pool with 1000 excluded subnets.

BenchmarkIPPoolopsns/opB/opallocs/op
BenchmarkIPPool/IPPool566216112144020622007
BenchmarkIPPool/RoaringBitmap135982420521884111106
BenchmarkIPPool/PrefixPool21803298500100199574418689007
     
BenchmarkIPPool/IPPool-21009107930844022322008
BenchmarkIPPool/RoaringBitmap-2298535160121885011106
BenchmarkIPPool/PrefixPool-221355259309102185601619835510
     
BenchmarkIPPool/IPPool-41126100524944024022008
BenchmarkIPPool/RoaringBitmap-4549419322121884711106
BenchmarkIPPool/PrefixPool-421365976629102185734019835525
     
BenchmarkIPPool/IPPool-81011109587144026522009
BenchmarkIPPool/RoaringBitmap-8639816310721884211106
BenchmarkIPPool/PrefixPool-821319444212101258958019802446
     
BenchmarkIPPool/IPPool-16996110209844025022008
BenchmarkIPPool/RoaringBitmap-16762617932721885111106
BenchmarkIPPool/PrefixPool-1621408024424101258906819802437

# Functions

New instantiates a ip pool as red-black tree with the specified ip length.
NewPool - Creates new PrefixPool with initial prefixes list.
NewWithNet instantiates a ip pool as red-black tree with the specified ip network.
NewWithNetString instantiates a ip pool as red-black tree with the specified ip network.

# Structs

IPPool holds available ip addresses in the structure of red-black tree.
PrefixPool - keeps prefixes for both IPv4 and IPv6 addresses.