ipranger

package module
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 11 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ipranger

ipranger helps you to keep track of yours ip with the integration of khulnasoft-labs hmap key value store.

ipranger also integrate mapcidr library:

...
ips, err := ipranger.Ips("127.0.0.1/16")
if err != nil {
	panic(err)
}
fmt.Println(len(ips))
...

License

ipranger is distributed under MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ips

func Ips(cidr string) ([]string, error)

Ips of a cidr

Types

type IPRanger

type IPRanger struct {
	sync.RWMutex

	Np *networkpolicy.NetworkPolicy

	Hosts         *hybrid.HybridMap
	Stats         Stats
	CoalescedIPV4 []*net.IPNet
	CoalescedIPV6 []*net.IPNet
	// contains filtered or unexported fields
}

func New

func New() (*IPRanger, error)

func (*IPRanger) Add

func (ir *IPRanger) Add(host string) error

func (*IPRanger) AddHostWithMetadata

func (ir *IPRanger) AddHostWithMetadata(host, metadata string) error

func (*IPRanger) Close

func (ir *IPRanger) Close() error

func (*IPRanger) Contains

func (ir *IPRanger) Contains(host string) bool

func (*IPRanger) ContainsAll

func (ir *IPRanger) ContainsAll(hosts ...string) bool

func (*IPRanger) ContainsAny

func (ir *IPRanger) ContainsAny(hosts ...string) bool

func (*IPRanger) Delete

func (ir *IPRanger) Delete(host string) error

func (*IPRanger) GetHostsByIP

func (ir *IPRanger) GetHostsByIP(IP string) ([]string, error)

func (*IPRanger) HasIP

func (ir *IPRanger) HasIP(IP string) bool

func (*IPRanger) IsValid

func (ir *IPRanger) IsValid(host string) bool

func (*IPRanger) Shrink

func (ir *IPRanger) Shrink() error

type Stats

type Stats struct {
	Hosts uint64
	IPS   uint64
	Ports uint64
}

func (Stats) Total

func (s Stats) Total() uint64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址