Skip to content

Commit dcc496b

Browse files
author
sky22333
committed
update docs
1 parent aeb045a commit dcc496b

18 files changed

Lines changed: 128 additions & 54 deletions

docs/src/content/docs/configuration/reference.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: HubProxy 配置文件完整参考。
1111
|----|------|--------|------|
1212
| `host` | string | `0.0.0.0` | 监听地址 |
1313
| `port` | int | `5000` | 监听端口 |
14-
| `fileSize` | int | `2147483648` | 单文件大小上限(字节),影响 GitHub 代理与离线镜像 |
14+
| `fileSize` | int | `2147483648` | 单文件大小上限(字节),仅影响 GitHub / Hugging Face URL 代理 |
1515
| `enableH2C` | bool | `false` | 启用 HTTP/2 Cleartext |
1616
| `enableFrontend` | bool | `true` | 启用 Web 界面(Vue SPA) |
1717

@@ -22,7 +22,7 @@ description: HubProxy 配置文件完整参考。
2222
| `requestLimit` | int | `500` | 每 IP 每周期允许请求数 |
2323
| `periodHours` | float | `3.0` | 限流周期(小时) |
2424

25-
IPv4 按完整 IP 计数,IPv6 按 `/64` 网段计数。前端静态路由`/``/images``/search``/assets/*`)不计入限流。
25+
IPv4 按完整 IP 计数,IPv6 按 `/64` 网段计数。仅前端静态路由`/``/images``/search``/favicon.ico``/assets/*`)不计入限流`/ready`、API 与代理请求均会计入
2626

2727
:::note
2828
Docker 拉取一个镜像会请求多个 layer,每个 HTTP 请求均消耗限流配额。
@@ -69,7 +69,7 @@ Docker 拉取一个镜像会请求多个 layer,每个 HTTP 请求均消耗限
6969
默认预置 `ghcr.io``gcr.io``quay.io``registry.k8s.io`。Docker Hub 固定走 `registry-1.docker.io`,不在此段配置。
7070

7171
:::note
72-
当前版本对所有 Registry 均使用匿名拉取(`authn.Anonymous`),`authType` 仅用于标识认证端点类型,**尚未**实现 GitHub Token 或 Google 服务账号等私有仓库凭据。私有镜像仍需客户端自行携带认证
72+
当前版本对所有 Registry 均使用匿名拉取(`authn.Anonymous`),`authType` 仅用于标识认证端点类型,**尚未**实现 GitHub Token 或 Google 服务账号等私有仓库凭据,且不转发客户端 `Authorization` 头。**无法**通过 HubProxy 拉取需要认证的私有镜像
7373
:::
7474

7575
## [tokenCache]
@@ -93,7 +93,7 @@ Manifest 缓存 TTL 规则:
9393

9494
| 路径 | 说明 |
9595
|------|------|
96-
| `GET /ready` | 健康检查,返回 `ready``version``uptime_sec`|
96+
| `GET /ready` | 健康检查,返回 `ready``version``uptime_sec`**计入** IP 限流) |
9797
| `GET /api/search?q=...` | Docker Hub 镜像搜索 |
9898
| `GET /api/tags/:namespace/:name` | 镜像标签列表 |
9999
| `GET /api/image/info?image=...` | 镜像元信息 |

docs/src/content/docs/en/configuration/reference.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Default config path is `./config.toml` in the working directory. Override with `
1111
|-----|------|---------|-------------|
1212
| `host` | string | `0.0.0.0` | Listen address |
1313
| `port` | int | `5000` | Listen port |
14-
| `fileSize` | int | `2147483648` | Max single-file size (bytes), affects GitHub proxy and offline images |
14+
| `fileSize` | int | `2147483648` | Max single-file size (bytes), GitHub / Hugging Face URL proxy only |
1515
| `enableH2C` | bool | `false` | Enable HTTP/2 Cleartext |
1616
| `enableFrontend` | bool | `true` | Enable web UI (Vue SPA) |
1717

@@ -22,7 +22,7 @@ Default config path is `./config.toml` in the working directory. Override with `
2222
| `requestLimit` | int | `500` | Requests per IP per period |
2323
| `periodHours` | float | `3.0` | Rate limit period (hours) |
2424

25-
IPv4 uses full addresses; IPv6 uses `/64` prefixes. Frontend static routes (`/`, `/images`, `/search`, `/assets/*`) are not rate-limited.
25+
IPv4 uses full addresses; IPv6 uses `/64` prefixes. Only frontend static routes (`/`, `/images`, `/search`, `/favicon.ico`, `/assets/*`) are exempt; `/ready`, API, and proxy requests all count.
2626

2727
:::note
2828
Pulling one Docker image triggers multiple layer requests — each HTTP request counts against the limit.
@@ -69,7 +69,7 @@ Per-registry keys:
6969
Defaults include `ghcr.io`, `gcr.io`, `quay.io`, `registry.k8s.io`. Docker Hub always proxies to `registry-1.docker.io` and is not configured here.
7070

7171
:::note
72-
All registries currently use anonymous pulls (`authn.Anonymous`). `authType` labels the auth endpoint only — **GitHub tokens and Google service accounts are not yet implemented**. Private images require client-side authentication.
72+
All registries currently use anonymous pulls (`authn.Anonymous`). `authType` labels the auth endpoint only — **GitHub tokens and Google service accounts are not yet implemented**, and client `Authorization` headers are not forwarded. **Private authenticated images cannot be pulled through HubProxy.**
7373
:::
7474

7575
## [tokenCache]
@@ -93,7 +93,7 @@ Upstream token `expires_in` is used for token cache (5-minute safety margin, min
9393

9494
| Path | Description |
9595
|------|-------------|
96-
| `GET /ready` | Health check — returns `ready`, `version`, `uptime_sec`, etc. |
96+
| `GET /ready` | Health check — returns `ready`, `version`, `uptime_sec`, etc. (**counts toward** rate limit) |
9797
| `GET /api/search?q=...` | Docker Hub image search |
9898
| `GET /api/tags/:namespace/:name` | Image tag list |
9999
| `GET /api/image/info?image=...` | Image metadata |

docs/src/content/docs/en/faq.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Strongly recommended. It provides TLS, correct client IP passing, and avoids exp
2020
<details>
2121
<summary>What's the difference between rate-limit and registry whitelists?</summary>
2222

23-
`[security].whiteList` exempts IPs from rate limiting. `[access].whiteList` controls which Docker images and GitHub repos can be proxied. They are independent.
23+
`[security].whiteList` exempts IPs from rate limiting. `[access].whiteList` controls which Docker images, GitHub repos, and Hugging Face resources can be proxied. They are independent.
2424

2525
</details>
2626

@@ -55,7 +55,7 @@ If HubProxy connects directly to Cloudflare edges, rate limits apply per Cloudfl
5555
<details>
5656
<summary>How do I verify the service is running?</summary>
5757

58-
Visit `https://example.com/ready` — a healthy response includes `ready`, `service`, `version`, and `uptime_sec`.
58+
Visit `https://example.com/ready` — a healthy response includes `ready`, `service`, `version`, and `uptime_sec`. This path **counts toward** the IP rate limit; avoid high-frequency polling.
5959

6060
</details>
6161

@@ -87,6 +87,6 @@ Add a regex to `githubExps` in `src/handlers/github.go`. See [Development & Buil
8787
<details>
8888
<summary>Why can't I pull private images with authType github?</summary>
8989

90-
`authType` labels auth endpoints only — credential injection is not yet implemented. All registry pulls use anonymous auth. Use client-side `docker login` for private images.
90+
`authType` labels auth endpoints only — credential injection is not yet implemented. All registry pulls use anonymous auth and client `Authorization` headers are not forwarded. **Private authenticated images cannot be pulled through HubProxy.**
9191

9292
</details>

docs/src/content/docs/en/guides/docker-mirror-sources.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enabled = true
4545
| `quay` | Quay.io auth endpoint |
4646

4747
:::note
48-
`authType` matches upstream token auth endpoints only. The current version does **not** inject GitHub tokens or Google service accounts — all pulls use anonymous auth. Private images require client-side `docker login`.
48+
`authType` matches upstream token auth endpoints only. The current version does **not** inject GitHub tokens or Google service accounts — all pulls use anonymous auth and client credentials are not forwarded. **Private authenticated images cannot be pulled.**
4949
:::
5050

5151
## Pull Path Format

docs/src/content/docs/en/guides/docker-mirror.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ curl "https://example.com/api/tags/library/nginx"
6262
- Each layer counts against rate limits
6363
- Configure `[access].whiteList` for public deployments
6464
- Ensure correct client IP behind reverse proxy — see [Reverse Proxy](/en/deployment/reverse-proxy/)
65-
- Anonymous upstream pulls; private images need client-side `docker login`
65+
- Anonymous upstream pulls**private authenticated images cannot be pulled through HubProxy**
6666

6767
## Other environments
6868

docs/src/content/docs/en/guides/github-proxy.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@ git clone https://example.com/https://github.com/owner/repo.git
2222
curl "https://example.com/https://api.github.com/repos/owner/repo/releases/latest"
2323
```
2424

25+
### Global Git acceleration
26+
27+
Use `url.<base>.insteadOf` so every `https://github.com/` clone/fetch goes through HubProxy automatically:
28+
29+
```bash
30+
git config --global url."https://example.com//https://github.com/".insteadOf "https://github.com/"
31+
```
32+
33+
Then clone as usual:
34+
35+
```bash
36+
git clone https://github.com/owner/repo.git
37+
# actually requests https://example.com//https://github.com/owner/repo.git
38+
```
39+
40+
HubProxy normalizes extra leading slashes in the path — this is equivalent to a single-slash prefix form.
41+
42+
To remove:
43+
44+
```bash
45+
git config --global --unset url.https://example.com//https://github.com/.insteadOf
46+
```
47+
2548
### Omit `https://`
2649

2750
HubProxy auto-prepends the scheme:
@@ -57,7 +80,7 @@ HubProxy can rewrite GitHub URLs inside `.sh` / `.ps1` install scripts (max 10MB
5780
|-------|-------------|
5881
| Web content | `text/html`, `application/xml`, etc. are blocked (403) — not for browsing GitHub pages |
5982
| File size | `[server].fileSize` caps single-file downloads (default 2GB) |
60-
| Repo access | `[access].whiteList` / `blackList` restrict proxied GitHub repos |
83+
| Repo access | `[access].whiteList` / `blackList` restrict proxied GitHub repos and Hugging Face resources |
6184

6285
Large Release files support `wget -c` resume — see [Transfer Capabilities](/en/guides/capabilities/).
6386

docs/src/content/docs/en/guides/huggingface.mdx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ curl -L -O "https://example.com/huggingface.co/bert-base-uncased/resolve/main/py
2525
curl -L -O "https://example.com/https://cdn-lfs.hf.co/user/model-repo/abc123..."
2626
```
2727

28-
## Python / huggingface_hub
29-
30-
Replace original HF URLs with:
31-
32-
```
33-
https://example.com/https://huggingface.co/...
34-
```
35-
36-
Ensure paths match Hugging Face regexes in `githubExps`.
37-
3828
## Limits
3929

4030
Same as [GitHub Acceleration](/en/guides/github-proxy/):

docs/src/content/docs/en/guides/kubernetes-containerd.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ sudo systemctl restart containerd
7979
## Notes
8080

8181
- Configure every node; use HTTPS in production
82-
- Private images need `imagePullSecrets`; HubProxy pulls upstream anonymously
82+
- HubProxy pulls upstream anonymously**private authenticated images cannot be proxied**
8383
- See [Transfer Capabilities](/en/guides/capabilities/)

docs/src/content/docs/en/guides/offline-images.mdx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,31 @@ Downloads use a **two-step flow**: `prepare` for a one-time token, then download
99

1010
## Web UI
1111

12-
Visit the HubProxy homepage and use the offline image feature. When selecting an architecture, if the image does not provide the selected architecture or the input is invalid, it automatically falls back to `linux/amd64`.
12+
Visit the HubProxy homepage and use the offline image feature. Leave architecture empty to prefer `linux/amd64`; if a specified architecture is unmatched, the first available platform in the multi-arch index is used.
13+
14+
## Image Reference Format
15+
16+
Besides Docker Hub official images, enter a full registry-prefixed reference to pull from other platforms:
17+
18+
| Source | Example input |
19+
|--------|---------------|
20+
| Docker Hub | `nginx`, `redis:7` |
21+
| GHCR | `ghcr.io/sky22333/hubproxy`, `ghcr.io/owner/app:v1.0` |
22+
| Quay | `quay.io/coreos/etcd:latest` |
23+
| GCR / K8s | `gcr.io/distroless/base`, `registry.k8s.io/pause:3.9` |
24+
25+
Missing tags default to `:latest`. Single-segment names (no `/`) get the `library/` namespace. The registry must be enabled in `[registries]` and the image must be anonymously pullable.
26+
27+
## Compressed Layers
28+
29+
The web UI and API expose a compressed-layers toggle (`compressed` / `useCompressedLayers`, **on by default**). **Keep it enabled** in most cases.
30+
31+
| Setting | Contents of each `layer.tar` in the archive | Size | Use case |
32+
|---------|-----------------------------------------------|------|----------|
33+
| On (default) | **Compressed blob** from the registry (usually gzip) | Smaller, faster download | Modern Docker Engine, `docker load` |
34+
| Off | **Uncompressed** filesystem layer tar (classic `docker save` format) | Larger, slower to build | Older Docker Engine versions or environments that only accept uncompressed layers |
35+
36+
HubProxy outputs a `docker load`-compatible tar. With compression enabled, each layer keeps the upstream compressed blob instead of decompressing and re-packing on the server, which saves bandwidth and CPU. The off switch remains for **legacy Docker** (image format v1 era and early `docker load` implementations): those expect uncompressed filesystem tars in `layer.tar`, matching `docker save` output — disabling compression produces the same layer format.
1337

1438
## Single Image API
1539

@@ -37,9 +61,9 @@ Optional parameters:
3761

3862
| Param | Description |
3963
|-------|-------------|
40-
| `platform` | Target platform, e.g. `linux/arm64`; falls back to `linux/amd64` if unmatched or invalid |
64+
| `platform` | Target platform, e.g. `linux/arm64`; empty prefers `linux/amd64`; if specified but unmatched, uses the first available platform in the index |
4165
| `tag` | Used when image has no tag, default `latest` |
42-
| `compressed` | Compress layers, default `true` |
66+
| `compressed` | Keep registry-compressed layers in tar, default `true` (recommended — see **Compressed Layers** above) |
4367

4468
## Batch API
4569

@@ -48,7 +72,7 @@ Optional parameters:
4872
```bash
4973
curl -X POST "https://example.com/api/image/batch?mode=prepare" \
5074
-H "Content-Type: application/json" \
51-
-d '{"images":["nginx:latest","redis:alpine"]}'
75+
-d '{"images":["nginx:latest","ghcr.io/sky22333/hubproxy:latest"],"useCompressedLayers":true}'
5276
```
5377

5478
**Step 2: Download combined tar**
@@ -81,4 +105,4 @@ maxImages = 10
81105

82106
- Large images take longer; streamed downloads must restart if interrupted
83107
- Subject to `[access]` lists and IP rate limiting
84-
- `/ready` and frontend static pages are not rate-limited; API and proxy requests are
108+
- Frontend static routes (`/`, `/images`, `/search`, `/assets/*`) are not rate-limited; `/ready`, API, and proxy requests all count

docs/src/content/docs/en/security/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ HubProxy is an open proxy service — improper deployment creates abuse risk. Fo
1111
|-----------|-------------|
1212
| IP rate limiting | Per real client IP (IPv6 uses `/64`) |
1313
| IP allow/deny | `[security]` controls rate-limit exemption and blocking |
14-
| Repo access control | `[access]` restricts proxied images and GitHub repos |
14+
| Repo access control | `[access]` restricts proxied images, GitHub repos, and Hugging Face resources |
1515
| Trusted proxies | Forward headers trusted only from private/local networks |
1616
| File size limit | `[server].fileSize` prevents oversized file abuse |
1717
| Offline download tokens | One-time tokens bound to IP and User-Agent, 2-minute TTL |

0 commit comments

Comments
 (0)