cf

package
v1.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CloudflareASN = 13335
	BufferSize    = 10000
)
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 GetCloudflareIPv6Ranges added in v1.4.17

func GetCloudflareIPv6Ranges() []string

func GetCloudflareRanges

func GetCloudflareRanges() []string

func LoadConfigLines added in v1.5.1

func LoadConfigLines(input string) ([]string, error)

func RunScanner

func RunScanner(config *ScanConfig) error

Types

type ConfigTestResult added in v1.5.1

type ConfigTestResult struct {
	OK         bool
	Error      string
	DurationMs float64
	FinalURI   string
}

func TestConfigAgainstIP added in v1.5.1

func TestConfigAgainstIP(pc *ParsedProxyConfig, ip net.IP, port int, timeout time.Duration) ConfigTestResult

type ParsedProxyConfig added in v1.5.1

type ParsedProxyConfig struct {
	Raw      string
	Protocol string
	UUID     string
	OrigHost string
	OrigPort int
	Path     string
	HostHdr  string
	SNI      string
	ALPN     []string
	Security string
	Network  string
	Insecure bool
	Fp       string
	Tag      string
}

func ParseProxyConfigLine added in v1.5.1

func ParseProxyConfigLine(line string) (*ParsedProxyConfig, error)

type ScanConfig

type ScanConfig struct {
	Sources          []string
	WorkerCount      int
	Ports            []int
	EnableHTTP2      bool
	EnableHTTP3      bool
	EnableSpeedTest  bool
	EnablePacketLoss bool
	EnableGeoIP      bool
	EnableReverseDNS bool
	GeoIPDBPath      string
	ASNDBPath        string
	OutputFormat     string
	OutputPath       string
	TestDomain       string

	SpeedTestHost      string
	RateLimit          int
	RealTimePrint      bool
	ShowProgress       bool
	MaxResults         int
	Timeout            int
	PortScanTimeout    int
	SortBy             string
	NoColor            bool
	MaxIPsPerRange     int
	RandomSample       bool
	ShuffleIPs         bool
	LatencySamples     int
	SaveValidIPs       bool
	StopAfterGood      int
	GoodScoreThreshold int
	ScoreWeights       ScoreWeights
	ScoreConfigPath    string

	TestConfigEnabled bool
	TestConfigRaw     string
	ConfigTestTimeout int

	AutoSubnetScan  bool
	SubnetPrefixLen int
	// contains filtered or unexported fields
}

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"`

	CloudflareConfidence int `json:"cloudflare_confidence" yaml:"cloudflare_confidence" csv:"cloudflare_confidence"`

	IsGenuineCFRange bool `json:"is_genuine_cf_range" yaml:"is_genuine_cf_range" csv:"is_genuine_cf_range"`

	IsProxy bool `json:"is_proxy" yaml:"is_proxy" csv:"is_proxy"`

	Datacenter string `json:"datacenter" yaml:"datacenter" csv:"datacenter"`
	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"`

	TLSFingerprint string `json:"tls_fingerprint" yaml:"tls_fingerprint" csv:"tls_fingerprint"`

	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"`
	HTTP11         bool   `json:"http11" yaml:"http11" csv:"http11"`

	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"`
	QUICHandshakeMs float64 `json:"quic_handshake_ms" yaml:"quic_handshake_ms" csv:"quic_handshake_ms"`
	TTFBMs          float64 `json:"ttfb_ms" yaml:"ttfb_ms" csv:"ttfb_ms"`
	DownloadMs      float64 `json:"download_ms" yaml:"download_ms" csv:"download_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"`
	TCPFailureRate float64 `json:"tcp_failure_rate" yaml:"tcp_failure_rate" csv:"tcp_failure_rate"`

	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"`
	ScannedAt time.Time `json:"scanned_at" yaml:"scanned_at" csv:"scanned_at"`

	ConfigTested    bool    `json:"config_tested" yaml:"config_tested" csv:"config_tested"`
	ConfigTestOK    bool    `json:"config_test_ok" yaml:"config_test_ok" csv:"config_test_ok"`
	ConfigTestError string  `json:"config_test_error" yaml:"config_test_error" csv:"config_test_error"`
	ConfigTestMs    float64 `json:"config_test_ms" yaml:"config_test_ms" csv:"config_test_ms"`
	ConfigFinalURI  string  `json:"config_final_uri" yaml:"config_final_uri" csv:"config_final_uri"`
}

type ScanStats

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

func (*ScanStats) Snapshot added in v1.4.17

func (s *ScanStats) Snapshot() (total, scanned, alive, dead, http3 int64, best float64)

type ScoreWeights added in v1.4.17

type ScoreWeights struct {
	Latency      float64 `yaml:"latency"`
	Reliability  float64 `yaml:"reliability"`
	HTTP3        float64 `yaml:"http3"`
	TLS          float64 `yaml:"tls"`
	Speed        float64 `yaml:"speed"`
	Cloudflare   float64 `yaml:"cloudflare"`
	LatencyRefMs float64 `yaml:"latency_ref_ms"`
	SpeedRefMBps float64 `yaml:"speed_ref_mbps"`
}

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(config *ScanConfig, geoDB *geoip2.Reader, asnDB *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