增加CF-CDN说明
This commit is contained in:
47
README.md
47
README.md
@@ -55,6 +55,53 @@ docker run -d \
|
|||||||
ghcr.io/sky22333/hub-proxy
|
ghcr.io/sky22333/hub-proxy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>CF-CDN获取用户真实IP</summary>
|
||||||
|
|
||||||
|
|
||||||
|
- 替换`Caddyfile`配置
|
||||||
|
|
||||||
|
```
|
||||||
|
hub.{$DOMAIN} {
|
||||||
|
reverse_proxy * ghproxy:5000 {
|
||||||
|
header_up X-Real-IP {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-Proto {http.request.scheme}
|
||||||
|
header_up CF-IPCountry {http.request.header.CF-IPCountry}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docker.{$DOMAIN} {
|
||||||
|
@v2_manifest_blob path_regexp v2_rewrite ^/v2/([^/]+)/(manifests|blobs)/(.*)$
|
||||||
|
handle @v2_manifest_blob {
|
||||||
|
rewrite * /v2/library/{re.v2_rewrite.1}/{re.v2_rewrite.2}/{re.v2_rewrite.3}
|
||||||
|
}
|
||||||
|
|
||||||
|
reverse_proxy * docker:5000 {
|
||||||
|
header_up X-Real-IP {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-Proto {http.request.scheme}
|
||||||
|
header_up CF-IPCountry {http.request.header.CF-IPCountry}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ghcr.{$DOMAIN} {
|
||||||
|
reverse_proxy * ghcr:5000 {
|
||||||
|
header_up X-Real-IP {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
|
||||||
|
header_up X-Forwarded-Proto {http.request.scheme}
|
||||||
|
header_up CF-IPCountry {http.request.header.CF-IPCountry}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sizeLimit = 1024 * 1024 * 1024 * 10 // 允许的文件大小,默认10GB
|
sizeLimit = 1024 * 1024 * 1024 * 2 // 允许的文件大小,默认2GB
|
||||||
host = "0.0.0.0" // 监听地址
|
host = "0.0.0.0" // 监听地址
|
||||||
port = 5000 // 监听端口
|
port = 5000 // 监听端口
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1030,7 +1030,7 @@ func cleanupTempFiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 如果总大小超过10GB,清理所有文件,防止恶意下载导致磁盘爆满
|
// 如果总大小超过10GB,清理所有文件,防止恶意下载导致磁盘爆满
|
||||||
if totalSize > 10*1024*1024*1024 { // 15GB
|
if totalSize > 10*1024*1024*1024 {
|
||||||
fmt.Printf("临时文件总大小超过10GB (当前: %.2f GB),清理所有文件\n", float64(totalSize)/(1024*1024*1024))
|
fmt.Printf("临时文件总大小超过10GB (当前: %.2f GB),清理所有文件\n", float64(totalSize)/(1024*1024*1024))
|
||||||
cleanAll()
|
cleanAll()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user