{
  "ok": true,
  "service": "cf-relay",
  "version": "1.1.0",
  "description": "把 HTTP(S) 下载直链包装成 Cloudflare Worker 中转链接；中转链接本身即可直接下载，支持 Range 断点续传。",
  "auth": {
    "required": false,
    "methods": [
      "?token=xxx",
      "Authorization: Bearer xxx",
      "X-API-Key: xxx"
    ],
    "note": "/api 与 /api/health 始终公开，其余接口在 Worker 配置了 TOKEN 时才需要令牌"
  },
  "max_batch": 50,
  "endpoints": [
    {
      "method": "GET",
      "path": "/api",
      "auth": false,
      "desc": "本索引。",
      "example": "https://get.3w.pm/api"
    },
    {
      "method": "GET",
      "path": "/api/health",
      "auth": false,
      "desc": "存活检测：版本、时间、是否需令牌。",
      "example": "https://get.3w.pm/api/health"
    },
    {
      "method": "GET",
      "path": "/api/config",
      "auth": true,
      "desc": "当前策略：域名黑白名单、大小上限、缓存 TTL、User-Agent 等。",
      "example": "https://get.3w.pm/api/config"
    },
    {
      "method": "GET / POST",
      "path": "/api/link",
      "auth": true,
      "desc": "生成中转链接，默认路径拼接形态（域名后面直接接原始直链）。GET 用重复的 url 参数批量，POST 用 {\"urls\":[...]}；加 info=true 会顺带探测。",
      "example": "https://get.3w.pm/api/link?url=https%3A%2F%2Fexample.com%2Fa.zip",
      "example_post": "curl -X POST https://get.3w.pm/api/link -H 'content-type: application/json' -d '{\"urls\":[\"https://example.com/a.zip\"],\"info\":true}'"
    },
    {
      "method": "GET / POST",
      "path": "/api/info",
      "auth": true,
      "desc": "探测上游：大小、类型、是否支持 Range、最终 URL（跟随 302 后）。",
      "example": "https://get.3w.pm/api/info?url=https%3A%2F%2Fexample.com%2Fa.zip"
    },
    {
      "method": "GET",
      "path": "/api/check",
      "auth": true,
      "desc": "策略预检：只判断域名是否放行，不发上游请求，不返回 403。",
      "example": "https://get.3w.pm/api/check?url=https%3A%2F%2Fexample.com%2Fa.zip"
    }
  ],
  "link_forms": {
    "path_join": "https://get.3w.pm/https://example.com/a.zip",
    "with_name": "https://get.3w.pm/https://example.com/a.zip?name=a.zip",
    "query": "https://get.3w.pm/?url=https%3A%2F%2Fexample.com%2Fa.zip",
    "probe": "https://get.3w.pm/https://example.com/a.zip?mode=info"
  },
  "notes": [
    "推荐路径拼接形态：域名后面直接接原始直链，如 https://get.3w.pm/https://example.com/a.zip；仅当原始链接自带的 query 命中保留字（url/u/q/token/name/mode）时，才会带上 ?url= 形式。",
    "路径拼接形态下，源站自己的 ?token= 只在 Worker 配置了 TOKEN 时才会被当作访问令牌而剥掉；若源站依赖这几个保留参数名，请用 relay_url_query。",
    "被域名黑白名单拦下时，relay_url 仍会返回，只在 allowed / reason 里标注；真正下载才会得到 403 JSON。",
    "relay_url 默认不含令牌；需要「拿去就能打开」的链接时传 embed_token=1。",
    "Worker 转发时强制 Accept-Encoding: identity，因此 content_length 与实际字节数一致。"
  ]
}