From e4252d0596e0c5372dac92caddde050b32b3bfc8 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Thu, 2 Jan 2025 10:37:18 +0800 Subject: [PATCH 001/296] update caddy --- CHANGELOG.md | 5 +++++ DEV-VERSION | 2 +- docker/dockerfile/dev/Dockerfile | 4 ++-- docker/dockerfile/release/Dockerfile | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82d3b96..1825be6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +25w01b +--- +- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 +- CHANGE: 将底包更新至`v2.9.0` + 25w01a --- - PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用; 同时,这也是2025年的第一个pre-release版本,祝各位新年快乐! (同时,请注意版本号的变化) diff --git a/DEV-VERSION b/DEV-VERSION index d5f6ac9..2f8a75c 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w01a \ No newline at end of file +25w01b \ No newline at end of file diff --git a/docker/dockerfile/dev/Dockerfile b/docker/dockerfile/dev/Dockerfile index 465ac6b..5fa5637 100644 --- a/docker/dockerfile/dev/Dockerfile +++ b/docker/dockerfile/dev/Dockerfile @@ -1,4 +1,4 @@ -FROM wjqserver/caddy:v24.12.20-alpine AS builder +FROM wjqserver/caddy:2.9.0-alpine AS builder ARG USER=WJQSERVER-STUDIO ARG REPO=ghproxy @@ -36,7 +36,7 @@ RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.co RUN chmod +x /data/${APPLICATION}/${APPLICATION} RUN chmod +x /usr/local/bin/init.sh -FROM wjqserver/caddy:v24.12.20-alpine +FROM wjqserver/caddy:2.9.0-alpine RUN apk add --no-cache curl diff --git a/docker/dockerfile/release/Dockerfile b/docker/dockerfile/release/Dockerfile index eb750df..3b2302e 100644 --- a/docker/dockerfile/release/Dockerfile +++ b/docker/dockerfile/release/Dockerfile @@ -1,4 +1,4 @@ -FROM wjqserver/caddy:v24.12.20-alpine AS builder +FROM wjqserver/caddy:2.9.0-alpine AS builder ARG USER=WJQSERVER-STUDIO ARG REPO=ghproxy @@ -36,7 +36,7 @@ RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.co RUN chmod +x /data/${APPLICATION}/${APPLICATION} RUN chmod +x /usr/local/bin/init.sh -FROM wjqserver/caddy:v24.12.20-alpine +FROM wjqserver/caddy:2.9.0-alpine RUN apk add --no-cache curl From a281d4c779cc7615d7a5ad4a7261d6c5e11ae9a7 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Fri, 3 Jan 2025 17:25:15 +0800 Subject: [PATCH 002/296] 25w01c --- CHANGELOG.md | 5 +++++ DEV-VERSION | 2 +- proxy/proxy.go | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1825be6..2f947c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +25w01c +--- +- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 +- CHANGE: 改进token参数透传功能 + 25w01b --- - PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 diff --git a/DEV-VERSION b/DEV-VERSION index 2f8a75c..3fb0839 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w01b \ No newline at end of file +25w01c \ No newline at end of file diff --git a/proxy/proxy.go b/proxy/proxy.go index 1238358..1704dc2 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -286,6 +286,9 @@ func authPassThrough(c *gin.Context, cfg *config.Config, req *req.Request) { req.SetHeader("Authorization", "token "+token) } else { logWarning("%s %s %s %s %s Auth-Error: Conflict Auth Method", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) + // 500 Internal Server Error + c.JSON(http.StatusInternalServerError, gin.H{"error": "Conflict Auth Method"}) + return } case "header": if cfg.Auth.Enabled { @@ -293,6 +296,9 @@ func authPassThrough(c *gin.Context, cfg *config.Config, req *req.Request) { } default: logWarning("%s %s %s %s %s Invalid Auth Method / Auth Method is not be set", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) + // 500 Internal Server Error + c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid Auth Method / Auth Method is not be set"}) + return } } } From 972baee564a7422532fbab0ef348c2326a89daca Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Fri, 3 Jan 2025 18:45:25 +0800 Subject: [PATCH 003/296] 25w01d --- .gitignore | 4 +++- CHANGELOG.md | 5 +++++ DEV-VERSION | 2 +- proxy/proxy.go | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index eee416a..3431fbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -demo.toml \ No newline at end of file +demo.toml +dev +*.log \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f947c1..8e023cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +25w01d +--- +- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 +- CHANGE: 尝试修复部分问题 + 25w01c --- - PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 diff --git a/DEV-VERSION b/DEV-VERSION index 3fb0839..6cb0584 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w01c \ No newline at end of file +25w01d \ No newline at end of file diff --git a/proxy/proxy.go b/proxy/proxy.go index 1704dc2..eeca0fa 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -179,6 +179,7 @@ func ProxyRequest(c *gin.Context, u string, cfg *config.Config, mode string, run // 发送HEAD请求, 预获取Content-Length headReq := client.R() setRequestHeaders(c, headReq) + authPassThrough(c, cfg, headReq) headResp, err := headReq.Head(u) if err != nil { From a0e5846e113cc4dd09f689f365dbf4e71d6e2cdc Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Fri, 3 Jan 2025 21:20:10 +0800 Subject: [PATCH 004/296] 25w01e --- CHANGELOG.md | 5 +++++ DEV-VERSION | 2 +- proxy/proxy.go | 34 ++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e023cd..812378e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +25w01e +--- +- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 +- FIX: 修复引入token参数透传功能导致的一些问题 + 25w01d --- - PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用 diff --git a/DEV-VERSION b/DEV-VERSION index 6cb0584..ac52583 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w01d \ No newline at end of file +25w01e \ No newline at end of file diff --git a/proxy/proxy.go b/proxy/proxy.go index eeca0fa..8b1a230 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -281,25 +281,27 @@ func setRequestHeaders(c *gin.Context, req *req.Request) { func authPassThrough(c *gin.Context, cfg *config.Config, req *req.Request) { if cfg.Auth.PassThrough { token := c.Query("token") - switch cfg.Auth.AuthMethod { - case "parameters": - if !cfg.Auth.Enabled { - req.SetHeader("Authorization", "token "+token) - } else { - logWarning("%s %s %s %s %s Auth-Error: Conflict Auth Method", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) + if token != "" { + switch cfg.Auth.AuthMethod { + case "parameters": + if !cfg.Auth.Enabled { + req.SetHeader("Authorization", "token "+token) + } else { + logWarning("%s %s %s %s %s Auth-Error: Conflict Auth Method", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) + // 500 Internal Server Error + c.JSON(http.StatusInternalServerError, gin.H{"error": "Conflict Auth Method"}) + return + } + case "header": + if cfg.Auth.Enabled { + req.SetHeader("Authorization", "token "+token) + } + default: + logWarning("%s %s %s %s %s Invalid Auth Method / Auth Method is not be set", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) // 500 Internal Server Error - c.JSON(http.StatusInternalServerError, gin.H{"error": "Conflict Auth Method"}) + c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid Auth Method / Auth Method is not be set"}) return } - case "header": - if cfg.Auth.Enabled { - req.SetHeader("Authorization", "token "+token) - } - default: - logWarning("%s %s %s %s %s Invalid Auth Method / Auth Method is not be set", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto) - // 500 Internal Server Error - c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid Auth Method / Auth Method is not be set"}) - return } } } From 17a2ba173d942f3ad47c94e234af7dce1a337bb5 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Sun, 5 Jan 2025 11:57:47 +0800 Subject: [PATCH 005/296] update deps --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index b306cae..5a5e0e3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/WJQSERVER-STUDIO/go-utils/logger v1.1.0 github.com/gin-gonic/gin v1.10.0 github.com/imroc/req/v3 v3.49.1 - golang.org/x/time v0.8.0 + golang.org/x/time v0.9.0 ) require ( @@ -17,7 +17,7 @@ require ( github.com/cloudflare/circl v1.5.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.7 // indirect + github.com/gabriel-vasile/mimetype v1.4.8 // indirect github.com/gin-contrib/sse v1.0.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -42,13 +42,13 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect go.uber.org/mock v0.5.0 // indirect - golang.org/x/arch v0.12.0 // indirect + golang.org/x/arch v0.13.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect + golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.33.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect + golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/tools v0.28.0 // indirect google.golang.org/protobuf v1.36.1 // indirect diff --git a/go.sum b/go.sum index e86fec6..29590c0 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= -github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= +github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= +github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= @@ -101,12 +101,12 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= -golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= -golang.org/x/arch v0.12.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/arch v0.13.0 h1:KCkqVVV1kGg0X87TFysjCJ8MxtZEIU4Ja/yXGeoECdA= +golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 h1:9kj3STMvgqy3YA4VQXBrN7925ICMxD5wzMRcgA30588= +golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= @@ -114,12 +114,12 @@ golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= From 2aa665d89a0137bb9e2bd47dffd3f81ff3f8ef9a Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Sun, 5 Jan 2025 11:58:28 +0800 Subject: [PATCH 006/296] update copyright info --- pages/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/index.html b/pages/index.html index c37afa5..b3de9fd 100644 --- a/pages/index.html +++ b/pages/index.html @@ -463,7 +463,7 @@