File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed
Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,53 @@ docker run -d \
5555 ghcr.io/sky22333/hub-proxy
5656```
5757
58+ ---
59+ ---
60+
61+
62+ <details >
63+ <summary >CF-CDN获取用户真实IP</summary >
64+
65+
66+ - 替换` Caddyfile ` 配置
67+
68+ ```
69+ hub.{$DOMAIN} {
70+ reverse_proxy * ghproxy:5000 {
71+ header_up X-Real-IP {http.request.header.CF-Connecting-IP}
72+ header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
73+ header_up X-Forwarded-Proto {http.request.scheme}
74+ header_up CF-IPCountry {http.request.header.CF-IPCountry}
75+ }
76+ }
77+
78+ docker.{$DOMAIN} {
79+ @v2_manifest_blob path_regexp v2_rewrite ^/v2/([^/]+)/(manifests|blobs)/(.*)$
80+ handle @v2_manifest_blob {
81+ rewrite * /v2/library/{re.v2_rewrite.1}/{re.v2_rewrite.2}/{re.v2_rewrite.3}
82+ }
83+
84+ reverse_proxy * docker:5000 {
85+ header_up X-Real-IP {http.request.header.CF-Connecting-IP}
86+ header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
87+ header_up X-Forwarded-Proto {http.request.scheme}
88+ header_up CF-IPCountry {http.request.header.CF-IPCountry}
89+ }
90+ }
91+
92+ ghcr.{$DOMAIN} {
93+ reverse_proxy * ghcr:5000 {
94+ header_up X-Real-IP {http.request.header.CF-Connecting-IP}
95+ header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
96+ header_up X-Forwarded-Proto {http.request.scheme}
97+ header_up CF-IPCountry {http.request.header.CF-IPCountry}
98+ }
99+ }
100+ ```
101+
102+ </details >
103+
104+
58105---
59106---
60107
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import (
1616)
1717
1818const (
19- sizeLimit = 1024 * 1024 * 1024 * 10 // 允许的文件大小,默认10GB
19+ sizeLimit = 1024 * 1024 * 1024 * 2 // 允许的文件大小,默认2GB
2020 host = "0.0.0.0" // 监听地址
2121 port = 5000 // 监听端口
2222)
Original file line number Diff line number Diff line change @@ -1030,7 +1030,7 @@ func cleanupTempFiles() {
10301030 }
10311031
10321032 // 如果总大小超过10GB,清理所有文件,防止恶意下载导致磁盘爆满
1033- if totalSize > 10 * 1024 * 1024 * 1024 { // 15GB
1033+ if totalSize > 10 * 1024 * 1024 * 1024 {
10341034 fmt .Printf ("临时文件总大小超过10GB (当前: %.2f GB),清理所有文件\n " , float64 (totalSize )/ (1024 * 1024 * 1024 ))
10351035 cleanAll ()
10361036 } else {
You can’t perform that action at this time.
0 commit comments