{"id":29407707,"url":"https://github.com/sky22333/hubproxy","last_synced_at":"2026-02-02T04:19:21.135Z","repository":{"id":298606126,"uuid":"885377863","full_name":"sky22333/hubproxy","owner":"sky22333","description":"多功能代理加速服务，提供 Docker 镜像加速、GitHub 加速、下载离线镜像等功能。一个二进制文件实现所有功能，支持仓库审计。流式转发，不占用存储空间。","archived":false,"fork":false,"pushed_at":"2026-01-26T16:08:02.000Z","size":9078,"stargazers_count":2233,"open_issues_count":4,"forks_count":282,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-01-27T03:56:56.931Z","etag":null,"topics":["devops","docker","docker-proxy","github","github-proxy","go","proxy","proxy-server","registry","registry-proxy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sky22333.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-08T13:23:51.000Z","updated_at":"2026-01-26T17:18:16.000Z","dependencies_parsed_at":"2025-06-12T00:38:15.037Z","dependency_job_id":"510d184f-a8d0-4cc4-8033-a4b48375d89d","html_url":"https://github.com/sky22333/hubproxy","commit_stats":null,"previous_names":["sky22333/hubproxy","sky22333/hub-proxy"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/sky22333/hubproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky22333%2Fhubproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky22333%2Fhubproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky22333%2Fhubproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky22333%2Fhubproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sky22333","download_url":"https://codeload.github.com/sky22333/hubproxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky22333%2Fhubproxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29004719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T01:32:03.847Z","status":"online","status_checked_at":"2026-02-02T02:00:07.448Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","docker","docker-proxy","github","github-proxy","go","proxy","proxy-server","registry","registry-proxy"],"created_at":"2025-07-11T01:02:02.051Z","updated_at":"2026-02-02T04:19:21.130Z","avatar_url":"https://github.com/sky22333.png","language":"Go","readme":"# HubProxy\n\n **Docker 和 GitHub 加速代理服务器**\n\n一个轻量级、高性能的多功能代理服务，提供 Docker 镜像加速、GitHub 文件加速、下载离线镜像、在线搜索 Docker 镜像等功能。\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://count.getloli.com/get/@sky22333.hubproxy?theme=rule34\" alt=\"Visitors\"\u003e\n\u003c/p\u003e\n\n## 特性\n\n- 🐳 **Docker 镜像加速** - 支持 Docker Hub、GHCR、Quay 等多个镜像仓库加速，流式传输优化拉取速度。\n- 🐳 **离线镜像包** - 支持下载离线镜像包，流式传输加防抖设计。\n- 📁 **GitHub 文件加速** - 加速 GitHub Release、Raw 文件下载，支持`api.github.com`，脚本嵌套加速等等\n- 🤖 **AI 模型库支持** - 支持 Hugging Face 模型下载加速\n- 🛡️ **智能限流** - IP 限流保护，防止滥用\n- 🚫 **仓库审计** - 强大的自定义黑名单，白名单，同时审计镜像仓库，和GitHub仓库\n- 🔍 **镜像搜索** - 在线搜索 Docker 镜像\n- ⚡ **轻量高效** - 基于 Go 语言，单二进制文件运行，资源占用低。\n- 🔧 **统一配置** - 统一配置管理，便于维护。\n- 🛡️ **完全自托管** - 避免依赖免费第三方服务的不稳定性，例如`cloudflare`等等。\n- 🚀 **多服务统一加速** - 单个程序即可统一加速 Docker、GitHub、Hugging Face 等多种服务，简化部署与管理。\n\n## 详细文档\n\n[中文文档](https://zread.ai/sky22333/hubproxy)\n\n[English](https://deepwiki.com/sky22333/hubproxy)\n\n## 快速开始\n\n### Docker部署（推荐）\n```\ndocker run -d \\\n  --name hubproxy \\\n  -p 5000:5000 \\\n  --restart always \\\n  ghcr.io/sky22333/hubproxy\n```\n\n### 一键脚本安装\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/sky22333/hubproxy/main/install.sh | sudo bash\n```\n\n支持单个二进制文件直接启动，无需其他配置，内置默认配置，支持所有功能。\n\n这个脚本会：\n- 自动检测系统架构（AMD64/ARM64）\n- 从 GitHub Releases 下载最新版本\n- 自动配置系统服务\n- 保留现有配置（升级时）\n\n## 使用方法\n\n### Docker 镜像加速\n\n```bash\n# 原命令\ndocker pull nginx\n\n# 使用加速\ndocker pull yourdomain.com/nginx\n\n# ghcr加速\ndocker pull yourdomain.com/ghcr.io/sky22333/hubproxy\n\n# 符合Docker Registry API v2标准的仓库都支持\n```\n\n当然也支持配置为全局镜像加速，在主机上新建（或编辑）`/etc/docker/daemon.json`\n\n在 `\"registry-mirrors\"` 中加入域名：\n\n```json\n{\n  \"registry-mirrors\": [\n    \"https://yourdomain.com\"\n  ]\n}\n```\n\n若已设置其他加速地址，直接并列添加后保存，再执行 `sudo systemctl restart docker` 重启docker服务让配置生效。\n\n### GitHub 文件加速\n\n```bash\n# 原链接\nhttps://github.com/user/repo/releases/download/v1.0.0/file.tar.gz\n\n# 加速链接\nhttps://yourdomain.com/https://github.com/user/repo/releases/download/v1.0.0/file.tar.gz\n\n# 加速下载仓库\ngit clone https://yourdomain.com/https://github.com/sky22333/hubproxy.git\n```\n\n## 配置\n\n\u003cdetails\u003e\n  \u003csummary\u003econfig.toml 配置说明\u003c/summary\u003e\n\n*此配置是默认配置，已经内置在程序中了*\n\n```\n[server]\nhost = \"0.0.0.0\"\n# 监听端口\nport = 5000\n# Github文件大小限制（字节），默认2GB\nfileSize = 2147483648\n# HTTP/2 多路复用，提升下载速度\nenableH2C = false\n# 是否启用前端静态页面\nenableFrontend = true\n\n[rateLimit]\n# 每个IP每周期允许的请求数(注意Docker镜像会有多个层，会消耗多个次数)\nrequestLimit = 500\n# 限流周期（小时）\nperiodHours = 3.0\n\n[security]\n# IP白名单，支持单个IP或IP段\n# 白名单中的IP不受限流限制\nwhiteList = [\n    \"127.0.0.1\",\n    \"172.17.0.0/16\",\n    \"192.168.1.0/24\"\n]\n\n# IP黑名单，支持单个IP或IP段\n# 黑名单中的IP将被直接拒绝访问\nblackList = [\n    \"192.168.100.1\",\n    \"192.168.100.0/24\"\n]\n\n[access]\n# 代理服务白名单（支持GitHub仓库和Docker镜像，支持通配符）\n# 只允许访问白名单中的仓库/镜像，为空时不限制\nwhiteList = []\n\n# 代理服务黑名单（支持GitHub仓库和Docker镜像，支持通配符）\n# 禁止访问黑名单中的仓库/镜像\nblackList = [\n    \"baduser/malicious-repo\",\n    \"*/malicious-repo\",\n    \"baduser/*\"\n]\n\n# 代理配置，支持有用户名/密码认证和无认证模式\n# 无认证: socks5://127.0.0.1:1080\n# 有认证: socks5://username:password@127.0.0.1:1080\n# 留空不使用代理\nproxy = \"\" \n\n[download]\n# 批量下载离线镜像数量限制\nmaxImages = 10\n\n# Registry映射配置，支持多种镜像仓库上游\n[registries]\n\n# GitHub Container Registry\n[registries.\"ghcr.io\"]\nupstream = \"ghcr.io\"\nauthHost = \"ghcr.io/token\" \nauthType = \"github\"\nenabled = true\n\n# Google Container Registry\n[registries.\"gcr.io\"]\nupstream = \"gcr.io\"\nauthHost = \"gcr.io/v2/token\"\nauthType = \"google\"\nenabled = true\n\n# Quay.io Container Registry\n[registries.\"quay.io\"]\nupstream = \"quay.io\"\nauthHost = \"quay.io/v2/auth\"\nauthType = \"quay\"\nenabled = true\n\n# Kubernetes Container Registry\n[registries.\"registry.k8s.io\"]\nupstream = \"registry.k8s.io\"\nauthHost = \"registry.k8s.io\"\nauthType = \"anonymous\"\nenabled = true\n\n[tokenCache]\n# 是否启用缓存(同时控制Token和Manifest缓存)显著提升性能\nenabled = true\n# 默认缓存时间(分钟)\ndefaultTTL = \"20m\"\n```\n\n\u003c/details\u003e\n\n容器内的配置文件位于 `/root/config.toml`\n\n脚本部署配置文件位于 `/opt/hubproxy/config.toml`\n\n### 环境变量（可选）\n\n支持通过环境变量覆盖部分配置，优先级高于`config.toml`，以下是默认值：\n\n```\nSERVER_HOST=0.0.0.0             # 监听地址\nSERVER_PORT=5000                # 监听端口\nENABLE_H2C=false                # 是否启用 H2C\nENABLE_FRONTEND=true            # 是否启用前端静态页面\nMAX_FILE_SIZE=2147483648        # GitHub 文件大小限制（字节）\nRATE_LIMIT=500                  # 每周期请求数\nRATE_PERIOD_HOURS=3             # 限流周期（小时）\nIP_WHITELIST=127.0.0.1,192.168.1.0/24   # IP 白名单（逗号分隔）\nIP_BLACKLIST=192.168.100.1,192.168.100.0/24 # IP 黑名单（逗号分隔）\nMAX_IMAGES=10                   # 批量下载镜像数量限制\n```\n\n为了IP限流能够正常运行，反向代理需要传递IP头用来获取访客真实IP，以caddy为例：\n```\nexample.com {\n    reverse_proxy {\n        to 127.0.0.1:5000\n        header_up X-Real-IP {remote}\n        header_up X-Forwarded-For {remote}\n        header_up X-Forwarded-Proto {scheme}\n    }\n}\n```\ncloudflare CDN：\n```\nexample.com {\n    reverse_proxy 127.0.0.1:5000 {\n        header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}\n        header_up X-Real-IP {http.request.header.CF-Connecting-IP}\n        header_up X-Forwarded-Proto https\n        header_up X-Forwarded-Host {host}\n    }\n}\n```\n\n\u003e 对于使用nginx反代的用户，Github加速提示`无效输入`的问题可以参见[issues/62](https://github.com/sky22333/hubproxy/issues/62#issuecomment-3219572440)\n\n\n## ⚠️ 免责声明\n\n- 本程序仅供学习交流使用，请勿用于非法用途\n- 使用本程序需遵守当地法律法规\n- 作者不对使用者的任何行为承担责任\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**⭐ 如果这个项目对你有帮助，请给个 Star！⭐**\n\n\u003c/div\u003e\n\n## 界面预览\n\n![1](./.github/demo/demo1.jpg)\n\n## Star 趋势\n[![Star 趋势](https://starchart.cc/sky22333/hubproxy.svg?variant=adaptive)](https://starchart.cc/sky22333/hubproxy)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky22333%2Fhubproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsky22333%2Fhubproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky22333%2Fhubproxy/lists"}