diff --git a/CHANGELOG.md b/CHANGELOG.md index e378591..dfe5319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,5 @@ # 更新日志 -4.1.0 - 2025-06-17 ---- -- ADD: 加入基于`basic auth`的docker鉴权支持 - -4.1.0-rc.0 - 2025-06-17 ---- -- PRE-RELEASE: 此版本是v4.1.0预发布版本,请勿在生产环境中使用; -- ADD: 加入基于`basic auth`的docker鉴权支持 - -4.1.0-beta.0 - 2025-06-17 ---- -- BETA-TEST: 此版本是v4.1.0的测试版本,请勿在生产环境中使用; -- ADD: 加入基于`basic auth`的docker鉴权支持 - 4.0.0 - 2025-06-16 --- - CHANGE: 移交到Touka框架 diff --git a/DEV-VERSION b/DEV-VERSION index 038c952..efe3c7d 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -4.1.0-rc.0 +4.0.0-rc.0 \ No newline at end of file diff --git a/VERSION b/VERSION index 99eba4d..0c89fc9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.0 \ No newline at end of file +4.0.0 \ No newline at end of file diff --git a/config/config.go b/config/config.go index ba2ef62..3775a12 100644 --- a/config/config.go +++ b/config/config.go @@ -169,16 +169,10 @@ type OutboundConfig struct { [docker] enabled = false target = "ghcr" # ghcr/dockerhub -auth = false -[docker.credentials] -user1 = "testpass" -test = "test123" */ type DockerConfig struct { - Enabled bool `toml:"enabled"` - Target string `toml:"target"` - Auth bool `toml:"auth"` - Credentials map[string]string `toml:"credentials"` + Enabled bool `toml:"enabled"` + Target string `toml:"target"` } // LoadConfig 从 TOML 配置文件加载配置 diff --git a/config/config.toml b/config/config.toml index ecf4959..27585b2 100644 --- a/config/config.toml +++ b/config/config.toml @@ -67,8 +67,4 @@ url = "socks5://127.0.0.1:1080" # "http://127.0.0.1:7890" [docker] enabled = false -target = "dockerhub" # ghcr/dockerhub/ custom -auth = false -[docker.credentials] -user1 = "testpass" -test = "test123" \ No newline at end of file +target = "dockerhub" # ghcr/dockerhub/ custom \ No newline at end of file diff --git a/go.mod b/go.mod index db39a60..b073121 100644 --- a/go.mod +++ b/go.mod @@ -11,12 +11,11 @@ require ( require ( github.com/WJQSERVER-STUDIO/go-utils/limitreader v0.0.2 - github.com/fenthope/bauth v0.0.1 github.com/fenthope/ikumi v0.0.2 github.com/fenthope/reco v0.0.3 github.com/fenthope/record v0.0.3 github.com/hashicorp/golang-lru/v2 v2.0.7 - github.com/infinite-iroha/touka v0.2.5 + github.com/infinite-iroha/touka v0.2.4 github.com/wjqserver/modembed v0.0.1 ) diff --git a/go.sum b/go.sum index 1c3af22..9f0ed93 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/WJQSERVER-STUDIO/go-utils/limitreader v0.0.2 h1:8bBkKk6E2Zr+I5szL7gyc github.com/WJQSERVER-STUDIO/go-utils/limitreader v0.0.2/go.mod h1:yPX8xuZH+py7eLJwOYj3VVI/4/Yuy5+x8Mhq8qezcPg= github.com/WJQSERVER-STUDIO/httpc v0.7.0 h1:iHhqlxppJBjlmvsIjvLZKRbWXqSdbeSGGofjHGmqGJc= github.com/WJQSERVER-STUDIO/httpc v0.7.0/go.mod h1:M7KNUZjjhCkzzcg9lBPs9YfkImI+7vqjAyjdA19+joE= -github.com/fenthope/bauth v0.0.1 h1:+4UIQshGx3mYD4L3f2S4MLZOi5PWU7fU5GK3wsZvwzE= -github.com/fenthope/bauth v0.0.1/go.mod h1:1fveTpgfR1p+WXQ8MXm9BfBCeNYi55j23jxCOGOvBSA= github.com/fenthope/ikumi v0.0.2 h1:5oaSTf/Msp7M2O3o/X20omKWEQbFhX4KV0CVF21oCdk= github.com/fenthope/ikumi v0.0.2/go.mod h1:IYbxzOGndZv/yRrbVMyV6dxh06X2wXCbfxrTRM1IruU= github.com/fenthope/reco v0.0.3 h1:RmnQ0D9a8PWtwOODawitTe4BztTnS9wYwrDbipISNq4= @@ -18,8 +16,8 @@ github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 h1:o8UqXPI github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/infinite-iroha/touka v0.2.5 h1:x7lcKk0MIHGrPb9TMmgC+nG57G4SeFGflwrta2Lz3jo= -github.com/infinite-iroha/touka v0.2.5/go.mod h1:2MBPtsM+5ClIZ/E1mPEKx1Rb+KIndTwZlIa2CwRPV7A= +github.com/infinite-iroha/touka v0.2.4 h1:P1nmQYv4VEiTIahCw356VcFvpTFB9i11c31LeLh6WbM= +github.com/infinite-iroha/touka v0.2.4/go.mod h1:2MBPtsM+5ClIZ/E1mPEKx1Rb+KIndTwZlIa2CwRPV7A= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/wjqserver/modembed v0.0.1 h1:8ZDz7t9M5DLrUFlYgBUUmrMzxWsZPmHvOazkr/T2jEs= diff --git a/main.go b/main.go index 1dcdea9..f7cb6b1 100644 --- a/main.go +++ b/main.go @@ -15,8 +15,6 @@ import ( "ghproxy/config" "ghproxy/proxy" - "github.com/fenthope/bauth" - "ghproxy/weakcache" "github.com/fenthope/ikumi" @@ -364,7 +362,6 @@ func main() { } setupApi(cfg, r, version) setupPages(cfg, r) - r.RedirectTrailingSlash = false r.GET("/github.com/:user/:repo/releases/*filepath", func(c *touka.Context) { c.Set("matcher", "releases") @@ -414,7 +411,7 @@ func main() { proxy.RoutingHandler(cfg)(c) }) - r.GET("/v2/", r.UseIf(cfg.Docker.Auth, bauth.BasicAuthForStatic(cfg.Docker.Credentials, "GHProxy Docker Proxy")), func(c *touka.Context) { + r.GET("/v2/", func(c *touka.Context) { emptyJSON := "{}" c.Header("Content-Type", "application/json") c.Header("Content-Length", fmt.Sprint(len(emptyJSON))) @@ -425,11 +422,6 @@ func main() { c.Writer.Write([]byte(emptyJSON)) }) - r.GET("/v2", func(c *touka.Context) { - // 重定向到 /v2/ - c.Redirect(http.StatusMovedPermanently, "/v2/") - }) - r.ANY("/v2/:target/:user/:repo/*filepath", func(c *touka.Context) { proxy.GhcrWithImageRouting(cfg)(c) })