cleanip_scanner

package
v0.0.0-...-30fc540 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCFRanges

func DefaultCFRanges() []netip.Prefix

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewScannerEngine

func NewScannerEngine(opts *ScannerOptions) *Engine

func (*Engine) GetAvailableIPs

func (e *Engine) GetAvailableIPs(desc bool) []IPInfo

func (*Engine) Run

func (e *Engine) Run(ctx context.Context)

type IPInfQueue

type IPInfQueue struct {
	// contains filtered or unexported fields
}

func (*IPInfQueue) Dequeue

func (q *IPInfQueue) Dequeue() IPInfo

Dequeue removes and returns the item with the lowest RTT.

func (*IPInfQueue) Enqueue

func (q *IPInfQueue) Enqueue(item IPInfo)

Enqueue adds an item and then sorts the queue.

func (*IPInfQueue) Size

func (q *IPInfQueue) Size() int

Size returns the number of items in the queue.

type IPInfo

type IPInfo struct {
	AddrPort  netip.AddrPort
	RTT       time.Duration
	CreatedAt time.Time
}

type IPQueue

type IPQueue struct {
	// contains filtered or unexported fields
}

func NewIPQueue

func NewIPQueue(opts *ScannerOptions) *IPQueue

func (*IPQueue) AvailableIPs

func (q *IPQueue) AvailableIPs(desc bool) []IPInfo

func (*IPQueue) Dequeue

func (q *IPQueue) Dequeue() (IPInfo, bool)

func (*IPQueue) Enqueue

func (q *IPQueue) Enqueue(info IPInfo) bool

func (*IPQueue) Expire

func (q *IPQueue) Expire()

type IpGenerator

type IpGenerator struct {
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(opts *ScannerOptions) *IpGenerator

func (*IpGenerator) NextBatch

func (g *IpGenerator) NextBatch() ([]netip.Addr, error)

type LCG

type LCG struct {
	// contains filtered or unexported fields
}

LCG represents a linear congruential generator with full period.

func NewLCG

func NewLCG(size *big.Int) *LCG

NewLCG creates a new LCG instance with a given size.

func (*LCG) Next

func (lcg *LCG) Next() *big.Int

Next generates the next number in the sequence.

type ScannerOptions

type ScannerOptions struct {
	UseIPv4  bool
	UseIPv6  bool
	CidrList []netip.Prefix // CIDR ranges to scan
	// SelectedOps           int
	Logger *slog.Logger

	// UseHTTP3              bool
	// UseHTTP2              bool
	// DisableCompression bool
	// HTTPPath              string
	// Referrer              string
	// UserAgent             string
	// Hostname              string
	// WarpPrivateKey        string
	// WarpPeerPublicKey     string
	// WarpPresharedKey      string
	// Port                  uint16
	IPQueueSize     int
	IPQueueTTL      time.Duration
	MaxDesirableRTT time.Duration
	// IPQueueChangeCallback TIPQueueChangeCallback
	ConnectionTimeout time.Duration
	HandshakeTimeout  time.Duration
	PingFunc          func(netip.Addr) (IPInfo, error)
	ConcurrentPings   int
}

Jump to

Keyboard shortcuts

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