mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
25w31t-1
This commit is contained in:
parent
47de48bcce
commit
a7be65a111
4 changed files with 19 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
25w30e
|
||||
25w31t-1
|
||||
4
main.go
4
main.go
|
|
@ -459,6 +459,10 @@ func main() {
|
|||
proxy.RoutingHandler(cfg, limiter, iplimiter)(ctx, c)
|
||||
})
|
||||
|
||||
r.Any("/v2/*filepath", func(ctx context.Context, c *app.RequestContext) {
|
||||
proxy.GhcrRouting(cfg)(ctx, c)
|
||||
})
|
||||
|
||||
r.NoRoute(func(ctx context.Context, c *app.RequestContext) {
|
||||
proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ func ChunkedProxyRequest(ctx context.Context, c *app.RequestContext, u string, c
|
|||
}
|
||||
|
||||
setRequestHeaders(c, req)
|
||||
//removeWSHeader(req) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头)
|
||||
AuthPassThrough(c, cfg, req)
|
||||
|
||||
resp, err = client.Do(req)
|
||||
|
|
|
|||
14
proxy/ghcr.go
Normal file
14
proxy/ghcr.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ghproxy/config"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
)
|
||||
|
||||
func GhcrRouting(cfg *config.Config) app.HandlerFunc {
|
||||
return func(ctx context.Context, c *app.RequestContext) {
|
||||
ChunkedProxyRequest(ctx, c, "https://ghcr.io"+string(c.Request.RequestURI()), cfg, "ghcr")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue