mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-25 07:04:16 +00:00
Writing a routing rule today means remembering exact geosite:/geoip:/ ext:file:code syntax by hand, with no way to discover what categories actually exist in the .dat files sitting in the bin folder -- including custom ones like geosite_roscom.dat added via the Geodata auto-update feature. The Domain/IP fields in the rule editor now suggest categories as you type (e.g. "you" -> "geosite:youtube"), built live from whatever .dat files are actually on disk, while still accepting any free-typed value exactly as before. Backend: GET /panel/api/xray/getGeodataCategories scans the bin folder, parses matched geosite*/geoip*.dat files via xray-core's own exported protobuf types, and formats each category as the exact rule syntax xray-core's parser accepts -- geosite:/geoip: for the default files, ext:<file>:<code> for anything else (there's no shorthand for custom files). Cached in memory keyed by each file's (name, size, modTime) so a request-time scan is cheap until a file actually changes. Frontend: the Domain/IP inputs become Select "tags" fields fed by a new useGeodataCategories() query hook, with an explicit substring filter so "you" matches "geosite:youtube" (not a prefix). The array<->CSV-string adapter lives entirely at the FormField transform boundary, so the underlying form schema and saved rule shape are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api.go | ||
| api_auth_test.go | ||
| api_docs_test.go | ||
| base.go | ||
| client.go | ||
| dist.go | ||
| dist_test.go | ||
| group.go | ||
| host.go | ||
| host_test.go | ||
| inbound.go | ||
| index.go | ||
| login_limiter.go | ||
| login_limiter_test.go | ||
| node.go | ||
| node_credentials_writeonly_test.go | ||
| panel_update_test.go | ||
| server.go | ||
| setting.go | ||
| setting_test.go | ||
| spa.go | ||
| spa_test.go | ||
| util.go | ||
| util_test.go | ||
| websocket.go | ||
| xray_setting.go | ||
| xray_setting_geodata_test.go | ||