country/country_auto in buildProbeNodeView now come from a local MMDB lookup of the node's public address (held v4, held v6, seen v4, seen v6) instead of the pin alone / a hardcoded empty string. Layered data: local file in the data folder wins, embedded factory snapshot is the fallback, no database means the pre-flag empty shape. A weekly job conditionally downloads a fresher copy, validates it, atomically replaces the local file and hot-swaps the reader; no URL configured (geoipCountryDefaultURL / the geoip_country_url setting) means the updater stays silent. No address ever leaves the master.
24 lines
717 B
Go
24 lines
717 B
Go
package job
|
|
|
|
import (
|
|
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
|
)
|
|
|
|
// GeoIPCountryJob is the weekly refresh of the local country
|
|
// database behind the public pages' node flags (Q7: a local MMDB on
|
|
// the master, never an external per-node lookup). The service does
|
|
// the conditional download, validation and hot swap; with no update
|
|
// URL configured the pass is a no-op, so scheduling it is harmless
|
|
// on installs that never opted in.
|
|
type GeoIPCountryJob struct{}
|
|
|
|
// NewGeoIPCountryJob creates a geoip country job instance.
|
|
func NewGeoIPCountryJob() *GeoIPCountryJob {
|
|
return new(GeoIPCountryJob)
|
|
}
|
|
|
|
// Run executes one update pass.
|
|
func (j *GeoIPCountryJob) Run() {
|
|
service.UpdateGeoIPCountry()
|
|
}
|