mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
update
This commit is contained in:
parent
a66452cf10
commit
1adc3a3192
2 changed files with 3 additions and 3 deletions
2
main.go
2
main.go
|
|
@ -71,7 +71,7 @@ func readFlag() {
|
||||||
fmt.Println("[ERROR] cfg flag is deprecated, please use -c instead")
|
fmt.Println("[ERROR] cfg flag is deprecated, please use -c instead")
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(1)
|
os.Exit(2)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
flag.BoolVar(&showVersion, "v", false, "show version and exit") // 添加-v标志
|
flag.BoolVar(&showVersion, "v", false, "show version and exit") // 添加-v标志
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func NoRouteHandler(cfg *config.Config, limiter *rate.RateLimiter, iplimiter *ra
|
||||||
|
|
||||||
rawPath := strings.TrimPrefix(string(c.Request.RequestURI()), "/") // 去掉前缀/
|
rawPath := strings.TrimPrefix(string(c.Request.RequestURI()), "/") // 去掉前缀/
|
||||||
matches := re.FindStringSubmatch(rawPath) // 匹配路径
|
matches := re.FindStringSubmatch(rawPath) // 匹配路径
|
||||||
logInfo("Matches: %v", matches)
|
logInfo("URL: %v", matches)
|
||||||
|
|
||||||
// 匹配路径错误处理
|
// 匹配路径错误处理
|
||||||
if len(matches) < 3 {
|
if len(matches) < 3 {
|
||||||
|
|
@ -116,7 +116,7 @@ func NoRouteHandler(cfg *config.Config, limiter *rate.RateLimiter, iplimiter *ra
|
||||||
}
|
}
|
||||||
|
|
||||||
// IP METHOD URL USERAGENT PROTO MATCHES
|
// IP METHOD URL USERAGENT PROTO MATCHES
|
||||||
logDebug("%s %s %s %s %s Matches: %v", c.ClientIP(), c.Method(), rawPath, c.Request.Header.UserAgent(), c.Request.Header.GetProtocol(), matches)
|
logDebug("%s %s %s %s %s Matched: %v", c.ClientIP(), c.Method(), rawPath, c.Request.Header.UserAgent(), c.Request.Header.GetProtocol(), matcher)
|
||||||
|
|
||||||
switch matcher {
|
switch matcher {
|
||||||
case "releases", "blob", "raw", "gist", "api":
|
case "releases", "blob", "raw", "gist", "api":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue