diff options
| author | Troodi <troodi@bk.ru> | 2026-04-19 22:44:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-19 22:44:51 +0300 |
| commit | c2a2a36f5685bd90ce1a9eb8b1b09c5dd24bf6c2 (patch) | |
| tree | 84cb50241417c24e96172918e9072fb6e3d6b23f /web/web.go | |
| parent | e986a133f80b6b1fb231887806f4853edd540d7b (diff) | |
Fix geosite:ru rule (Normalization to RU vs lowercase ru) (#3971)
* Fix geosite:ru rule (Normalization to RU vs lowercase ru)
* fix
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -12,6 +12,7 @@ import ( "net" "net/http" "os" + "path/filepath" "strconv" "strings" "time" @@ -293,9 +294,26 @@ func (s *Server) initRouter() (*gin.Engine, error) { return engine, nil } +// normalizeExistingGeositeFiles normalizes country codes in all geosite .dat +// files found in the bin directory so Xray-core can locate entries correctly. +func normalizeExistingGeositeFiles() { + binDir := config.GetBinFolderPath() + matches, err := filepath.Glob(filepath.Join(binDir, "geosite*.dat")) + if err != nil { + logger.Warningf("Failed to glob geosite files: %v", err) + return + } + for _, path := range matches { + if err := service.NormalizeGeositeCountryCodes(path); err != nil { + logger.Warningf("Failed to normalize geosite country codes in %s: %v", path, err) + } + } +} + // startTask schedules background jobs (Xray checks, traffic jobs, cron // jobs) which the panel relies on for periodic maintenance and monitoring. func (s *Server) startTask() { + normalizeExistingGeositeFiles() s.customGeoService.EnsureOnStartup() err := s.xrayService.RestartXray(true) if err != nil { |
