This commit is contained in:
wjqserver 2025-08-11 18:28:03 +08:00
parent 8dca51b897
commit d389a61f09
10 changed files with 273 additions and 155 deletions

View file

@ -23,6 +23,7 @@ const (
gistPrefix = "https://gist.github.com/"
gistContentPrefix = "https://gist.githubusercontent.com/"
apiPrefix = "https://api.github.com/"
ociv2Prefix = "https://v2/"
releasesDownloadSnippet = "releases/download/"
)
@ -36,9 +37,11 @@ func init() {
// Matcher 从原始URL路径中高效地解析并匹配代理规则.
func Matcher(rawPath string, cfg *config.Config) (string, string, string, *GHProxyErrors) {
if len(rawPath) < 18 {
return "", "", "", NewErrorWithStatusLookup(404, "path too short")
}
/*
if len(rawPath) < 18 {
return "", "", "", NewErrorWithStatusLookup(404, "path too short")
}
*/
// 匹配 "https://github.com/"
if strings.HasPrefix(rawPath, githubPrefix) {