cf

package
v1.4.16 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudflareASN  = 13335
	BufferSize     = 10000
	RequestTimeout = 10 * time.Second
)
View Source
const (
	Reset   = "\033[0m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Magenta = "\033[35m"
	Cyan    = "\033[36m"
	White   = "\033[97m"
	Bold    = "\033[1m"
)

Variables

This section is empty.

Functions

func EstimateScanTime

func EstimateScanTime(ranges []string, workers int, ports []int, maxIPsPerRange int) (string, string)

func GetAllCloudflareRanges

func GetAllCloudflareRanges() []string

func GetCloudflareRanges

func GetCloudflareRanges() []string

func RunScanner

func RunScanner(config *ScanConfig) error

Types

type ScanConfig

type ScanConfig struct {
	Sources          []string
	WorkerCount      int
	Ports            []int
	EnableHTTP2      bool
	EnableHTTP3      bool
	EnableSpeedTest  bool
	EnableGeoIP      bool
	EnableReverseDNS bool
	EnableBenchmark  bool
	GeoIPDBPath      string
	OutputFormat     string
	OutputPath       string
	ResumeDBPath     string
	TestDomain       string
	RateLimit        int
	RealTimePrint    bool
	ShowProgress     bool
	MaxResults       int
	Timeout          int
	PortScanTimeout  int
	SortBy           string
	NoColor          bool
	MaxIPsPerRange   int
}

type ScanResult

type ScanResult struct {
	IP                string    `json:"ip" yaml:"ip" csv:"ip"`
	Port              int       `json:"port" yaml:"port" csv:"port"`
	IsAlive           bool      `json:"is_alive" yaml:"is_alive" csv:"is_alive"`
	IsCloudflare      bool      `json:"is_cloudflare" yaml:"is_cloudflare" csv:"is_cloudflare"`
	Score             int       `json:"score" yaml:"score" csv:"score"`
	Source            string    `json:"source" yaml:"source" csv:"source"`
	Country           string    `json:"country" yaml:"country" csv:"country"`
	City              string    `json:"city" yaml:"city" csv:"city"`
	Region            string    `json:"region" yaml:"region" csv:"region"`
	ASN               string    `json:"asn" yaml:"asn" csv:"asn"`
	Hostname          string    `json:"hostname" yaml:"hostname" csv:"hostname"`
	IsProxy           bool      `json:"is_proxy" yaml:"is_proxy" csv:"is_proxy"`
	EdgeType          string    `json:"edge_type" yaml:"edge_type" csv:"edge_type"`
	TLSVersion        string    `json:"tls_version" yaml:"tls_version" csv:"tls_version"`
	TLSCipher         string    `json:"tls_cipher" yaml:"tls_cipher" csv:"tls_cipher"`
	TLSALPN           string    `json:"tls_alpn" yaml:"tls_alpn" csv:"tls_alpn"`
	TLSSNI            string    `json:"tls_sni" yaml:"tls_sni" csv:"tls_sni"`
	CertIssuer        string    `json:"cert_issuer" yaml:"cert_issuer" csv:"cert_issuer"`
	CertSAN           string    `json:"cert_san" yaml:"cert_san" csv:"cert_san"`
	CertExpiry        time.Time `json:"cert_expiry" yaml:"cert_expiry" csv:"cert_expiry"`
	HTTPVersion       string    `json:"http_version" yaml:"http_version" csv:"http_version"`
	HTTP2Supported    bool      `json:"http2_supported" yaml:"http2_supported" csv:"http2_supported"`
	HTTP3Supported    bool      `json:"http3_supported" yaml:"http3_supported" csv:"http3_supported"`
	CFRay             string    `json:"cf_ray" yaml:"cf_ray" csv:"cf_ray"`
	CFCacheStatus     string    `json:"cf_cache_status" yaml:"cf_cache_status" csv:"cf_cache_status"`
	ServerHeader      string    `json:"server_header" yaml:"server_header" csv:"server_header"`
	CFRequestID       string    `json:"cf_request_id" yaml:"cf_request_id" csv:"cf_request_id"`
	TCPConnectMs      float64   `json:"tcp_connect_ms" yaml:"tcp_connect_ms" csv:"tcp_connect_ms"`
	TLSHandshakeMs    float64   `json:"tls_handshake_ms" yaml:"tls_handshake_ms" csv:"tls_handshake_ms"`
	TTFBMs            float64   `json:"ttfb_ms" yaml:"ttfb_ms" csv:"ttfb_ms"`
	DownloadMs        float64   `json:"download_ms" yaml:"download_ms" csv:"download_ms"`
	KeepAliveMs       float64   `json:"keep_alive_ms" yaml:"keep_alive_ms" csv:"keep_alive_ms"`
	DownloadSpeed1MB  float64   `json:"download_speed_1mb" yaml:"download_speed_1mb" csv:"download_speed_1mb"`
	DownloadSpeed10MB float64   `json:"download_speed_10mb" yaml:"download_speed_10mb" csv:"download_speed_10mb"`
	PacketLoss        float64   `json:"packet_loss" yaml:"packet_loss" csv:"packet_loss"`
	AverageLatency    float64   `json:"average_latency" yaml:"average_latency" csv:"average_latency"`
	MedianLatency     float64   `json:"median_latency" yaml:"median_latency" csv:"median_latency"`
	Jitter            float64   `json:"jitter" yaml:"jitter" csv:"jitter"`
	Ports             []int     `json:"ports" yaml:"ports" csv:"ports"`
	HTTP11            bool      `json:"http11" yaml:"http11" csv:"http11"`
	ScannedAt         time.Time `json:"scanned_at" yaml:"scanned_at" csv:"scanned_at"`
}

type ScanStats

type ScanStats struct {
	Total       int64
	Scanned     int64
	Alive       int64
	Dead        int64
	HTTP3       int64
	BestLatency float64
	// contains filtered or unexported fields
}

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(config *ScanConfig, geoDB *geoip2.Reader) *WorkerPool

func (*WorkerPool) Start

func (wp *WorkerPool) Start(wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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