This commit is contained in:
WJQSERVER 2024-10-12 10:20:20 +08:00
parent 6dc20398ae
commit 7fabd3c3e2
4 changed files with 43 additions and 34 deletions

View file

@ -1,5 +1,16 @@
# 更新日志 # 更新日志
v1.5.0
---
- CHANGE: 优化代码结构,提升性能
- CHANGE: 改进核心部分,即proxy模块的转发部分,对请求体处理与响应体处理进行优化
- CHANGE: 配置文件格式由yaml切换至toml,使其具备更好的可读性
- ADD: 黑白名单引入通配符支持,支持完全屏蔽或放行某个用户,例如`onwer/*`表示匹配`owner`的所有仓库
- ADD: 新增API模块,新增配置开关状态接口,以在前端指示功能状态
- CHANGE: 由于API变动,对前端进行相应调整
- ADD: 日志模块引入日志级别,排障更加直观
- CHANGE: 改进黑白名单机制,若禁用相关功能,则不对相关模块进行初始化
24w15d 24w15d
--- ---
- PRE-RELEASE: 此版本是v1.5.0的预发布版本,请勿在生产环境中使用 - PRE-RELEASE: 此版本是v1.5.0的预发布版本,请勿在生产环境中使用

View file

@ -16,7 +16,7 @@
- 支持Docker部署 - 支持Docker部署
- 支持速率限制 - 支持速率限制
- 支持用户鉴权 - 支持用户鉴权
- 支持自定义黑名单 - 支持自定义黑名单/白名单
- 符合[RFC 7234](https://httpwg.org/specs/rfc7234.html)的HTTP Cache - 符合[RFC 7234](https://httpwg.org/specs/rfc7234.html)的HTTP Cache
- 使用Caddy作为Web Server - 使用Caddy作为Web Server
- 基于[WJQSERVER-STUDIO/golang-temp](https://github.com/WJQSERVER-STUDIO/golang-temp)模板构建,具有标准化的日志记录与构建流程 - 基于[WJQSERVER-STUDIO/golang-temp](https://github.com/WJQSERVER-STUDIO/golang-temp)模板构建,具有标准化的日志记录与构建流程
@ -60,39 +60,33 @@ docker run -p 7210:80 -v ./ghproxy/log/run:/data/ghproxy/log -v ./ghproxy/log/ca
### 外部配置文件 ### 外部配置文件
本项目采用config.yaml作为外部配置,默认配置如下 本项目采用`config.toml`作为外部配置,默认配置如下
使用Docker部署时,慎重修改config.yaml,以免造成不必要的麻烦 使用Docker部署时,慎重修改`config.toml`,以免造成不必要的麻烦
```yaml ```toml
# 核心配置 [server]
server: host = "127.0.0.1" # 监听地址(小白请勿修改)
port: 8080 # 监听端口(小白请勿修改) port = 8080 #监听端口(小白请勿修改)
host: "127.0.0.1" # 监听地址(小白请勿修改) sizelimit = 131072000 # 125MB
sizelimit: 131072000 # 125MB
# 日志配置 [log]
logger: logfilepath = "/data/ghproxy/log/ghproxy.log" # 日志文件路径(小白请勿修改)
logfilepath: "/data/ghproxy/log/ghproxy.log" # 日志文件路径(小白请勿修改) maxlogsize = 5 # MB
maxlogsize: 5 # MB
# CORS 配置 [cors]
cors: enabled = true # 是否开启CORS
enabled: true # 是否开启CORS
# 鉴权配置 [auth]
auth: authtoken = "test" # 鉴权Token
enabled: false # 是否开启鉴权 enabled = false # 是否开启鉴权
authtoken: "test" # 鉴权Token
# 黑名单配置 [blacklist]
blacklist: blacklistfile = "/data/ghproxy/config/blacklist.json" # 黑名单文件路径
enabled: true # 是否开启黑名单 enabled = false # 是否开启黑名单
blacklistfile: "/data/ghproxy/config/blacklist.json"
# 白名单配置 [whitelist]
whitelist: enabled = false # 是否开启白名单
enabled: false # 是否开启白名单 whitelistfile = "/data/ghproxy/config/whitelist.json" # 白名单文件路径
whitelistfile: "/data/ghproxy/config/whitelist.json"
``` ```
@ -105,7 +99,7 @@ whitelist:
"blacklist": [ "blacklist": [
"test/test1", "test/test1",
"example/repo2", "example/repo2",
"another/repo3" "another/*"
] ]
} }
``` ```
@ -119,7 +113,7 @@ whitelist:
"whitelist": [ "whitelist": [
"test/test1", "test/test1",
"example/repo2", "example/repo2",
"another/repo3" "another/*"
] ]
} }
``` ```
@ -139,6 +133,10 @@ example.com {
} }
``` ```
### 前端页面
![ghproxy-demo-v1.5.0.png](https://webp.wjqserver.com/ghproxy/ghproxy-demo-v1.5.0.png)
## TODO & DEV ## TODO & DEV
### TODO ### TODO

View file

@ -26,7 +26,7 @@ RUN wget -O /usr/local/bin/init.sh https://raw.githubusercontent.com/${USER}/${R
# 拉取配置 # 拉取配置
RUN wget -O /data/caddy/Caddyfile https://raw.githubusercontent.com/${USER}/${REPO}/main/caddyfile/release/Caddyfile RUN wget -O /data/caddy/Caddyfile https://raw.githubusercontent.com/${USER}/${REPO}/main/caddyfile/release/Caddyfile
RUN wget -O /data/${APPLICATION}/config.yaml https://raw.githubusercontent.com/${USER}/${REPO}/main/config/config.yaml RUN wget -O /data/${APPLICATION}/config.toml https://raw.githubusercontent.com/${USER}/${REPO}/main/config/config.toml
RUN wget -O /data/${APPLICATION}/blacklist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/blacklist.json RUN wget -O /data/${APPLICATION}/blacklist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/blacklist.json
RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/whitelist.json RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/whitelist.json

View file

@ -14,13 +14,13 @@ if [ ! -f /data/${APPLICATION}/config/whitelist.json ]; then
cp /data/${APPLICATION}/whitelist.json /data/${APPLICATION}/config/whitelist.json cp /data/${APPLICATION}/whitelist.json /data/${APPLICATION}/config/whitelist.json
fi fi
if [ ! -f /data/${APPLICATION}/config/config.yaml ]; then if [ ! -f /data/${APPLICATION}/config/config.toml ]; then
cp /data/${APPLICATION}/config.yaml /data/${APPLICATION}/config/config.yaml cp /data/${APPLICATION}/config.toml /data/${APPLICATION}/config/config.toml
fi fi
/data/caddy/caddy run --config /data/caddy/config/Caddyfile > /data/${APPLICATION}/log/caddy.log 2>&1 & /data/caddy/caddy run --config /data/caddy/config/Caddyfile > /data/${APPLICATION}/log/caddy.log 2>&1 &
/data/${APPLICATION}/${APPLICATION} -cfg /data/${APPLICATION}/config/config.yaml > /data/${APPLICATION}/log/run.log 2>&1 & /data/${APPLICATION}/${APPLICATION} -cfg /data/${APPLICATION}/config/config.toml > /data/${APPLICATION}/log/run.log 2>&1 &
while true; do while true; do
sleep 1 sleep 1