cleanip

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CloudflareCIDRs = []string{
	"104.16.0.0/13",
	"104.24.0.0/14",
	"172.64.0.0/13",
	"162.158.0.0/15",
	"198.41.128.0/17",
	"197.234.240.0/22",
	"188.114.96.0/20",
	"190.93.240.0/20",
	"141.101.64.0/18",
	"108.162.192.0/18",
	"103.21.244.0/22",
	"103.22.200.0/22",
	"103.31.4.0/22",
}

CloudflareCIDRs contains standard IPv4 ranges assigned to Cloudflare edge network

View Source
var PopularCandidateIPs = []string{
	"104.16.132.229",
	"104.16.133.229",
	"104.17.150.100",
	"104.18.2.161",
	"104.19.241.93",
	"104.20.74.39",
	"104.21.49.191",
	"104.22.6.21",
	"104.25.158.11",
	"104.26.12.18",
	"162.159.130.105",
	"162.159.138.85",
	"172.64.155.209",
	"172.67.181.189",
	"172.67.74.152",
	"188.114.97.7",
	"188.114.98.224",
	"198.41.200.12",
	"198.41.214.162",
}

PopularCandidateIPs are high-probability clean edge IPs frequently operational across MCI, Irancell, TCI

Functions

func RandomIPsFromCIDRs

func RandomIPsFromCIDRs(cidrs []string, count int) []string

RandomIPsFromCIDRs samples up to `count` pseudo-random, unique host IPs from the given CIDR ranges. This is what makes the scanner actually "discover" fresh clean IPs rather than only re-ranking the same static PopularCandidateIPs list every run — important because an ISP can block those well-known IPs specifically while leaving the rest of the range open.

Types

type CleanIPResult

type CleanIPResult struct {
	IP         string        `json:"ip"`
	Port       int           `json:"port"`
	Latency    time.Duration `json:"latency"`
	Success    bool          `json:"success"`
	PacketLoss float64       `json:"packet_loss"`
}

CleanIPResult stores the scan result for a Cloudflare IP

type Scanner

type Scanner struct {
	Timeout     time.Duration
	Concurrency int
	SNI         string
	Port        int
}

Scanner scans candidate Cloudflare IPs concurrently

func NewScanner

func NewScanner(concurrency int, timeout time.Duration) *Scanner

NewScanner creates a new Cloudflare Clean IP scanner

func (*Scanner) ScanIPs

func (s *Scanner) ScanIPs(ctx context.Context, ipList []string, onProgress func(res CleanIPResult, done, total int)) []CleanIPResult

ScanIPs tests candidate IPs concurrently and returns them sorted by lowest latency

Jump to

Keyboard shortcuts

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