Compare commits
5 Commits
Rirmach/do
...
v1.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31f62fde35 | ||
|
|
8d7619c7e4 | ||
|
|
a09db34787 | ||
|
|
31a3b67ab0 | ||
|
|
3590c7c073 |
5
.github/demo/deepwiki.svg
vendored
5
.github/demo/deepwiki.svg
vendored
@@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="28" role="img" aria-label="DeepWiki">
|
|
||||||
<title>DeepWiki</title>
|
|
||||||
<rect width="90" height="28" rx="4" fill="#0f766e"></rect>
|
|
||||||
<text x="45" y="19" fill="#fff" font-family="Arial, Helvetica, sans-serif" font-size="12" text-anchor="middle">DeepWiki</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 320 B |
BIN
.github/demo/demo1.jpg
vendored
BIN
.github/demo/demo1.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 79 KiB |
BIN
.github/demo/demo2.jpg
vendored
BIN
.github/demo/demo2.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB |
BIN
.github/demo/demo3.jpg
vendored
BIN
.github/demo/demo3.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB |
40
README.md
40
README.md
@@ -1,12 +1,6 @@
|
|||||||
# HubProxy
|
# HubProxy
|
||||||
|
|
||||||
🚀 **Docker 和 GitHub 加速代理服务器**
|
**Docker 和 GitHub 加速代理服务器**
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://deepwiki.com/sky22333/hubproxy">
|
|
||||||
<img src="./.github/demo/deepwiki.svg" alt="DeepWiki">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
一个轻量级、高性能的多功能代理服务,提供 Docker 镜像加速、GitHub 文件加速、下载离线镜像、在线搜索 Docker 镜像等功能。
|
一个轻量级、高性能的多功能代理服务,提供 Docker 镜像加速、GitHub 文件加速、下载离线镜像、在线搜索 Docker 镜像等功能。
|
||||||
|
|
||||||
@@ -15,7 +9,7 @@
|
|||||||
<img src="https://count.getloli.com/get/@sky22333.hubproxy?theme=rule34" alt="Visitors">
|
<img src="https://count.getloli.com/get/@sky22333.hubproxy?theme=rule34" alt="Visitors">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## ✨ 特性
|
## 特性
|
||||||
|
|
||||||
- 🐳 **Docker 镜像加速** - 支持 Docker Hub、GHCR、Quay 等多个镜像仓库加速,流式传输优化拉取速度。
|
- 🐳 **Docker 镜像加速** - 支持 Docker Hub、GHCR、Quay 等多个镜像仓库加速,流式传输优化拉取速度。
|
||||||
- 🐳 **离线镜像包** - 支持下载离线镜像包,流式传输加防抖设计。
|
- 🐳 **离线镜像包** - 支持下载离线镜像包,流式传输加防抖设计。
|
||||||
@@ -29,8 +23,13 @@
|
|||||||
- 🛡️ **完全自托管** - 避免依赖免费第三方服务的不稳定性,例如`cloudflare`等等。
|
- 🛡️ **完全自托管** - 避免依赖免费第三方服务的不稳定性,例如`cloudflare`等等。
|
||||||
- 🚀 **多服务统一加速** - 单个程序即可统一加速 Docker、GitHub、Hugging Face 等多种服务,简化部署与管理。
|
- 🚀 **多服务统一加速** - 单个程序即可统一加速 Docker、GitHub、Hugging Face 等多种服务,简化部署与管理。
|
||||||
|
|
||||||
|
## 详细文档
|
||||||
|
|
||||||
## 🚀 快速开始
|
[中文文档](https://zread.ai/sky22333/hubproxy)
|
||||||
|
|
||||||
|
[English](https://deepwiki.com/sky22333/hubproxy)
|
||||||
|
|
||||||
|
## 快速开始
|
||||||
|
|
||||||
### Docker部署(推荐)
|
### Docker部署(推荐)
|
||||||
```
|
```
|
||||||
@@ -41,8 +40,6 @@ docker run -d \
|
|||||||
ghcr.io/sky22333/hubproxy
|
ghcr.io/sky22333/hubproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 一键脚本安装
|
### 一键脚本安装
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -52,14 +49,12 @@ curl -fsSL https://raw.githubusercontent.com/sky22333/hubproxy/main/install.sh |
|
|||||||
支持单个二进制文件直接启动,无需其他配置,内置默认配置,支持所有功能。
|
支持单个二进制文件直接启动,无需其他配置,内置默认配置,支持所有功能。
|
||||||
|
|
||||||
这个脚本会:
|
这个脚本会:
|
||||||
- 🔍 自动检测系统架构(AMD64/ARM64)
|
- 自动检测系统架构(AMD64/ARM64)
|
||||||
- 📥 从 GitHub Releases 下载最新版本
|
- 从 GitHub Releases 下载最新版本
|
||||||
- ⚙️ 自动配置系统服务
|
- 自动配置系统服务
|
||||||
- 🔄 保留现有配置(升级时)
|
- 保留现有配置(升级时)
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
## 📖 使用方法
|
|
||||||
|
|
||||||
### Docker 镜像加速
|
### Docker 镜像加速
|
||||||
|
|
||||||
@@ -103,7 +98,7 @@ https://yourdomain.com/https://github.com/user/repo/releases/download/v1.0.0/fil
|
|||||||
git clone https://yourdomain.com/https://github.com/sky22333/hubproxy.git
|
git clone https://yourdomain.com/https://github.com/sky22333/hubproxy.git
|
||||||
```
|
```
|
||||||
|
|
||||||
## ⚙️ 配置
|
## 配置
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>config.toml 配置说明</summary>
|
<summary>config.toml 配置说明</summary>
|
||||||
@@ -249,16 +244,9 @@ example.com {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
## 界面预览
|
## 界面预览
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Star 趋势
|
## Star 趋势
|
||||||
[](https://starchart.cc/sky22333/hubproxy)
|
[](https://starchart.cc/sky22333/hubproxy)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ func main() {
|
|||||||
fmt.Printf("H2c: 已启用\n")
|
fmt.Printf("H2c: 已启用\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("版本号: v1.1.9\n")
|
fmt.Printf("版本号: v1.2.0\n")
|
||||||
fmt.Printf("项目地址: https://github.com/sky22333/hubproxy\n")
|
fmt.Printf("项目地址: https://github.com/sky22333/hubproxy\n")
|
||||||
|
|
||||||
// 创建HTTP2服务器
|
// 创建HTTP2服务器
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GitHub URL正则表达式
|
// GitHub URL正则表达式
|
||||||
var githubRegex = regexp.MustCompile(`https?://(?:github\.com|raw\.githubusercontent\.com|raw\.github\.com|gist\.githubusercontent\.com|gist\.github\.com|api\.github\.com)[^\s'"]+`)
|
var githubRegex = regexp.MustCompile(`(?:^|[\s'"(=,\[{;|&<>])https?://(?:github\.com|raw\.githubusercontent\.com|raw\.github\.com|gist\.githubusercontent\.com|gist\.github\.com|api\.github\.com)[^\s'")]*`)
|
||||||
|
|
||||||
// ProcessSmart Shell脚本智能处理函数
|
// ProcessSmart Shell脚本智能处理函数
|
||||||
func ProcessSmart(input io.ReadCloser, isCompressed bool, host string) (io.Reader, int64, error) {
|
func ProcessSmart(input io.ReadCloser, isCompressed bool, host string) (io.Reader, int64, error) {
|
||||||
@@ -70,28 +70,34 @@ func readShellContent(input io.ReadCloser, isCompressed bool) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processGitHubURLs(content, host string) string {
|
func processGitHubURLs(content, host string) string {
|
||||||
return githubRegex.ReplaceAllStringFunc(content, func(url string) string {
|
return githubRegex.ReplaceAllStringFunc(content, func(match string) string {
|
||||||
return transformURL(url, host)
|
// 如果匹配包含前缀分隔符,保留它,防止出现重复转换
|
||||||
|
if len(match) > 0 && match[0] != 'h' {
|
||||||
|
prefix := match[0:1]
|
||||||
|
url := match[1:]
|
||||||
|
return prefix + transformURL(url, host)
|
||||||
|
}
|
||||||
|
return transformURL(match, host)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// transformURL URL转换函数
|
// transformURL URL转换函数
|
||||||
func transformURL(url, host string) string {
|
func transformURL(url, host string) string {
|
||||||
if strings.Contains(url, host) {
|
if strings.Contains(url, host) {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(url, "http://") {
|
if strings.HasPrefix(url, "http://") {
|
||||||
url = "https" + url[4:]
|
url = "https" + url[4:]
|
||||||
} else if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "//") {
|
} else if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "//") {
|
||||||
url = "https://" + url
|
url = "https://" + url
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保 host 有协议头
|
// 确保 host 有协议头
|
||||||
if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") {
|
if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") {
|
||||||
host = "https://" + host
|
host = "https://" + host
|
||||||
}
|
}
|
||||||
host = strings.TrimSuffix(host, "/")
|
host = strings.TrimSuffix(host, "/")
|
||||||
|
|
||||||
return host + "/" + url
|
return host + "/" + url
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user