About this project

Project Positioning: This is a continuous scanning and management workbench for "Optimized IPs" operating around Cloudflare's official IP address pools. The core scanning engine is the command-line tool cf_db.py, and the Web management console cf_web.py invokes this engine. Both are implemented using the Python 3.8+ standard library with no third-party dependencies. Scanning Principles and Quality Control: The system performs concurrent dialing probes on multiple ports followed by TLS handshake secondary confirmation to filter available CF edge IPs. It employs a "neighborhood weighting" sampling strategy where C-segments that have yielded high-quality IPs are prioritized for sampling, adjustable via --exploit. Results are persisted to SQLite, enabling a breakpoint resume mode. The database size is constrained by upper limits and a "tombstone" mechanism, where discarded dead IPs are silenced for a period to avoid redundant testing. Web Management Console: Access control is enabled by default upon startup; the first run generates a username and random password stored in cf_secret.json (permission 600), with all pages and APIs using Basic Auth. If openssl is present, self-signed HTTPS is enabled by default. The README notes that self-signed certificates only encrypt transmission to prevent LAN snooping and do not provide identity authentication; strong passwords are required for external exposure. The interface features a collapsible left navigation (drawer on mobile) with five views: - Overview Dashboard: Statistical cards (tested IPs are historical totals) and distribution charts for data centers, countries, latency, bandwidth, and routes. - Scan Control: Settings for address sources (Global official, CF official, Telecom, Unicom, Mobile optimized segments), ports, sampling size per round, concurrency, verification budget, bandwidth test count per round, speed test concurrency, speed test domain, region completion, re-verification, route detection budget and re-test cycle, high-quality C-segment ratio, maximum latency, and database limit, as well as toggles for TLS secondary confirmation, route classification, and IPv6 scanning. Parameters take effect immediately upon saving. - IP List: Filtering by data center (comma-separated), minimum bandwidth, maximum latency, IP inclusion, port, bandwidth-only, and IPv6-only; supports column sorting; selected items can be copied in ip:port#region format, exported to txt, or cleared across pages; supports pagination and exporting filtered results to ADD.txt / CSV. - Click Effects: Toggles and sliders for Blue Archive-style click effects and cursor trails, which take effect immediately and are saved locally in the browser for both desktop and touchscreens. - Wallpaper: The server parses and caches NASA APOD daily images, falling back to the most recent image if the day's content is a video or the API fails; a NASA API Key can be added to cf_settings.json to increase quotas. Manual Optimization: Users can manually optimize without waiting for the background scan. By setting the quantity N, priority (bandwidth or latency), region filters, bandwidth-only, or IPv6-only, the system first draws max(N×5, 20) candidates (up to 150) from the local library, then performs real-time connectivity tests, region identification, and bandwidth testing (concurrency 20) to display the top N results. Re-test data is written back to the local library as standard records, but the optimization list itself is not stored. Route Probing and Speed Test Endpoints: route_probe.py is an independent route classification probe that performs outbound ASN determination and hop-by-hop Traceroute to distinguish between Premium, Standard, and Mixed routes (requires the ping command). Speed tests default to public speed.cloudflare.com, which may be rate-limited; the README suggests deploying the included cf_speedtest_worker.js to Cloudflare Workers as a self-hosted speed test domain to avoid free-tier CPU limits using zero-block streaming. Interfaces and Commands: Web APIs include GET / (interface), /api/status, /api/stats, /api/table, /api/optimize, /api/copy, /api/export, and POST /api/control, /api/settings, /api/test. Common CLI parameters cover ports, candidates per round, concurrency, verification and bandwidth budgets, exploit ratio, max latency, route detection budget/cycle, IPv6, single/multi-round modes, round intervals, high-quality IP re-verification, seed import, export by count/region, and database limits; --stats is supported to view library statistics and coverage. IPv6: Prioritizes sampling from public optimized v6 lists (operator-matched + general sources) while incorporating official CF v6 blocks for random discovery, requiring the host to have IPv6 connectivity. Files include optional cf_settings.json (interface parameters) and vendor/ba-click-fx.js (Blue Archive-style click effect library, MIT, self-hosted). The system automatically generates login credentials, self-signed certificates, wallpaper cache, and ASN data files. The project is licensed under MIT.