mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6950] feat(hosts): clean IP scanner that saves working CDN IPs per ISP #6537
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6537
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6950
Author: @Plus98ir
Created: 10/26/2026
Status: 🔄 Open
Base:
main← Head:feat/clean-ip-scanner📝 Commits (10+)
8c002abfeat(hosts): clean IP scanner that saves working Cloudflare IPs per ISP54e674cfeat(hosts): full upload test and fragment finder for the clean IP scanner8ed6572feat(hosts): clean IP scanner in five steps; warn when the visitor is on WARP/VPN6e41f32fix(hosts): clean IP scanner rejects Cloudflare edge IPs that refuse the domain (error 1034)cde7508refactor(hosts): move the clean IP page's network lookup and step title into common.tsx1d651bffeat(hosts): show the datacenter city and country of each clean IP, with a country filter624fb48fix(hosts): send empty lists, not null, in a clean IP report with no valid rowsf52b377feat(hosts): scan your own IP list, find more IPs next to working ones, download CSVb5f5eb5style(hosts): keep the clean IP step titles readable on phonescae5a37chore(i18n): translate the clean IP scanner into every panel language📊 Changes
51 files changed (+8182 additions, -0 deletions)
View changed files
➕
docs/content/docs/en/reference/api/clean-ip-scanner.mdx(+64 -0)📝
docs/content/docs/en/reference/api/meta.json(+1 -0)📝
docs/public/openapi.json(+636 -0)📝
frontend/public/openapi.json(+636 -0)📝
frontend/src/components/command-palette/CommandPalette.tsx(+1 -0)📝
frontend/src/generated/examples.ts(+103 -0)📝
frontend/src/generated/schemas.ts(+332 -0)📝
frontend/src/generated/types.ts(+76 -0)📝
frontend/src/generated/zod.ts(+86 -0)📝
frontend/src/pages/api-docs/endpoints.ts(+49 -0)➕
frontend/src/pages/clean-ip/CleanIpPage.css(+244 -0)➕
frontend/src/pages/clean-ip/CleanIpPage.tsx(+1074 -0)➕
frontend/src/pages/clean-ip/FragmentStep.tsx(+216 -0)➕
frontend/src/pages/clean-ip/RangePicker.tsx(+82 -0)➕
frontend/src/pages/clean-ip/colos.ts(+165 -0)➕
frontend/src/pages/clean-ip/common.tsx(+57 -0)➕
frontend/src/pages/clean-ip/report.ts(+47 -0)➕
frontend/src/pages/clean-ip/scan.ts(+285 -0)📝
frontend/src/routes/panelRoutes.tsx(+8 -0)➕
frontend/src/test/clean-ip-colos.test.ts(+29 -0)...and 31 more files
📄 Description
Summary
Adds a Clean IP scanner page (
/clean-ip). It finds CDN edge IPs that work on a given ISP and saves them into a Host group as<group> · <ISP>(for exampleCDN · MCI), so each ISP's subscribers get IPs that work on their network. It supports Cloudflare, Fastly, Gcore and CloudFront.Why
In censored networks (Iran, Russia, Turkmenistan, …) CDN-fronted inbounds only work through "clean" edge IPs. Which IPs are clean differs per ISP and changes over time. Admins currently run external scanners (CF-Clean-Scanner and similar) and copy the results into Hosts by hand. This page does it inside the panel, per ISP, and writes the result where 3x-ui already reads it: Host groups.
How it works (five steps on the page)
CF-Connecting-IPis trusted only when the request really came from Cloudflare.wss://<ip>/(the panel's CSP allowswss:). You pick the CDN and which of its ranges to scan, as in CF-Clean-Scanner. You can also paste your own IP list, find more IPs next to working ones, or download the result as CSV. Each working IP shows its datacenter (city and country) and can be filtered by country.curl … | python3 -, or PowerShell) to run on a device on that ISP.fragmentsettings (tlshello/1-1, length and delay) against no fragment.curl --resolve), and the report goes through that IP too.fragmentfinalMask to that group. A "Check saved IPs" / "Remove restricted" action re-checks rows saved earlier.API (all documented in
endpoints.ts,openapi.jsonand the docs MDX)GET /panel/api/cleanip/networkGET /panel/api/cleanip/cdnsPOST /panel/api/cleanip/commandGET /panel/api/cleanip/command/:tokenPOST /panel/api/cleanip/verifyGET <base>cleanip/run/:token/script.py,POST <base>cleanip/run/:token/reportCommands live in memory only: at most 50, each valid for 24h, and lost on restart. The report endpoint accepts only its own token, caps the body at 256 KB, and validates every row (IPv4 only, known fragment shapes, bounded numbers).
Type of change
Areas affected
How was this tested?
internal/web/service/cleanip_test.go) cover:CF-Connecting-IPtrust rule;null;--resolvecommands.make genis clean, docs MDX regenerated, andgo test ./internal/web/..., typecheck, lint, format and build all pass.Screenshots / recordings
Steps 1-4 after a quick scan (local test panel, example domain):
The one-day full-test command:
Phone width:
Breaking changes
None. It is a new page and new routes. There is no DB migration: the scanner only writes ordinary Host rows through the existing host service.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.