[Fix]GeoSite.dat initial in logic rule

This commit is contained in:
Clash-Mini
2022-02-06 04:30:54 +08:00
parent 4a446c4e31
commit 7465eaafa1
3 changed files with 10 additions and 3 deletions

View File

@ -556,7 +556,7 @@ func parseRules(cfg *RawConfig, proxies map[string]C.Proxy) ([]C.Rule, map[strin
params = trimArr(params)
if ruleName == "GEOSITE" {
if err := initGeoSite(); err != nil {
if err := InitGeoSite(); err != nil {
return nil, nil, fmt.Errorf("can't initial GeoSite: %w", err)
}
}
@ -701,7 +701,7 @@ func parseFallbackIPCIDR(ips []string) ([]*net.IPNet, error) {
func parseFallbackGeoSite(countries []string, rules []C.Rule) ([]*router.DomainMatcher, error) {
var sites []*router.DomainMatcher
if len(countries) > 0 {
if err := initGeoSite(); err != nil {
if err := InitGeoSite(); err != nil {
return nil, fmt.Errorf("can't initial GeoSite: %w", err)
}
}

View File

@ -44,7 +44,7 @@ func downloadGeoSite(path string) (err error) {
return err
}
func initGeoSite() error {
func InitGeoSite() error {
if _, err := os.Stat(C.Path.GeoSite()); os.IsNotExist(err) {
log.Infoln("Need GeoSite but can't find GeoSite.dat, start download")
if err := downloadGeoSite(C.Path.GeoSite()); err != nil {