mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
chore: function rename
This commit is contained in:
parent
c6db154046
commit
496759ba7e
|
@ -73,7 +73,7 @@ func ParseProxyProvider(name string, mapping map[string]any) (types.ProxyProvide
|
||||||
}
|
}
|
||||||
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
||||||
} else {
|
} else {
|
||||||
path := C.Path.GetRandomPath("proxies", schema.URL)
|
path := C.Path.GetPathByHash("proxies", schema.URL)
|
||||||
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -74,7 +74,7 @@ func (p *path) IsSafePath(path string) bool {
|
||||||
return !strings.Contains(rel, "..")
|
return !strings.Contains(rel, "..")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *path) GetRandomPath(prefix, name string) string {
|
func (p *path) GetPathByHash(prefix, name string) string {
|
||||||
hash := md5.Sum([]byte(name))
|
hash := md5.Sum([]byte(name))
|
||||||
filename := hex.EncodeToString(hash[:])
|
filename := hex.EncodeToString(hash[:])
|
||||||
return filepath.Join(p.HomeDir(), prefix, filename)
|
return filepath.Join(p.HomeDir(), prefix, filename)
|
||||||
|
|
|
@ -67,7 +67,7 @@ func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(t
|
||||||
}
|
}
|
||||||
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
||||||
} else {
|
} else {
|
||||||
path := C.Path.GetRandomPath("rules", schema.URL)
|
path := C.Path.GetPathByHash("rules", schema.URL)
|
||||||
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
vehicle = resource.NewHTTPVehicle(schema.URL, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user