No description
Find a file
guochao f857d84a6e
Some checks failed
build container / build-container (push) Failing after 1s
run go test / test (push) Failing after 1s
fix(cmd/proxy): close cache-proxy server on shutdown
buildHTTPServer now returns both the *http.Server and the underlying
*cacheproxy.Server so that runNormalMode and the service handler can call
Server.Close() after the HTTP server shuts down. This ensures upstream
health checks, active streams, and storage backends are cleaned up.
2026-06-27 17:01:21 +08:00
.gitea/workflows chore(ci): update Go version to stable in workflow 2026-01-15 18:44:10 +08:00
cmd/proxy fix(cmd/proxy): close cache-proxy server on shutdown 2026-06-27 17:01:21 +08:00
memory-bank feat: 实现内存存储自动内存管理功能 2025-10-18 20:16:31 +08:00
pkgs fix(storage/local): fsync directory after rename and reopen in DuplicateFile 2026-06-27 16:57:44 +08:00
scripts feat: enhance PowerShell script to pass unrecognized parameters to proxy.exe 2025-10-16 16:02:40 +08:00
.clinerules feat: integrate to Windows service management 2025-10-16 09:42:08 +08:00
.dockerignore update docker files 2024-12-18 14:18:47 +08:00
.gitignore build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
compose.release.yaml add pprof handler 2025-03-03 00:26:29 +08:00
compose.yaml add pprof handler 2025-03-03 00:26:29 +08:00
config.go fix: disable passive health check by default and add file integrity validation 2026-01-15 18:25:38 +08:00
config.yaml fix: unify startup flow and upstream selection 2026-05-14 21:46:55 +08:00
default.nix build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
Dockerfile use latest golang / alpine image 2026-01-15 15:42:50 +08:00
failed_tests.md refactor: consolidate stale cache fallback logic into serve methods 2026-01-11 00:30:17 +08:00
flake.lock build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
flake.nix build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
go.mod feat: integrate to Windows service management 2025-10-16 09:42:08 +08:00
go.sum feat: integrate to Windows service management 2025-10-16 09:42:08 +08:00
health_checker.go fix: disable passive health check by default and add file integrity validation 2026-01-15 18:25:38 +08:00
health_checker_test.go fix: disable passive health check by default and add file integrity validation 2026-01-15 18:25:38 +08:00
README.md build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
server.go fix(server): verify completeness from disk size and protect TempFile lifetime 2026-06-27 16:57:44 +08:00
server_test.go fix(server): verify completeness from disk size and protect TempFile lifetime 2026-06-27 16:57:44 +08:00
shell.nix build: add nix flake and dev shell 2026-05-14 21:41:45 +08:00
upstream_manager.go fix: correct passive health check default behavior 2026-01-15 18:38:37 +08:00
upstream_manager_test.go test(upstream): fix data races in active health check tests 2026-06-27 16:57:44 +08:00

cache-proxy

用于缓存软件源和其他上游文件的 Go 代理服务。

开发

进入开发环境:

nix develop

运行测试:

go test ./...

直接运行:

go run ./cmd/proxy

常用参数:

go run ./cmd/proxy --config ./config.yaml --listen-addr :8881

Nix

构建默认包:

nix build .#default

运行构建产物:

./result/bin/cache-proxy --config ./config.yaml

flake.nix 只负责声明 nixpkgs input 和导出包、dev shell。
default.nixshell.nix 都从 flake.lock 解析并导入固定版本的 nixpkgs

配置

默认配置文件是仓库根目录的 config.yaml。可通过 --configCONFIG_PATH 指定其他路径。

服务默认监听 :8881,缓存目录默认在 ./data