piko 是一个命令行和 Go 库,用于通过 HTTP 范围请求进行分段下载,支持断点续传、自定义 DNS、代理和多种连接策略。

Stars

62

7 天增长

暂无数据

Fork 数

2

开放 Issue

0

开源协议

GPL-3.0

最近更新

2026-07-26

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它提供了专门的分段下载器,对并行度、连接策略和协议版本有精细控制,同时提供了可复用的 Go 库供程序化使用。

适合谁使用

  • 需要分段下载功能的 Go 开发者
  • 希望快速、可续传下载大文件的 CLI 用户
  • 优化批量文件传输的系统管理员
  • 在应用中集成下载速度测试的开发者

典型使用场景

  • 通过并行范围请求加速大文件下载
  • 中断下载后无需重新开始即可续传
  • 丢弃输出以测试下载吞吐量
  • 在 Go 程序中添加带自定义 DNS 和代理的分段下载逻辑

项目优势

  • 通过 .part 和 .part.resume 文件支持断点续传,并验证 ETag/Last-Modified
  • 提供多种连接策略(轮询、最快、顺序)和 IP 协议族控制
  • 提供 Go 库,包含 Download、DownloadBytes 和可复用的随机范围读取客户端
  • 支持自定义 DNS 解析器(UDP、DoT、DoH)和代理配置(包括环境变量)

使用前须知

  • 仅适用于支持 HTTP 范围请求的服务器;普通单流下载建议使用 curl
  • 没有内置单流回退机制(需用 --no-fallback 禁用自适应并发)
  • 仅支持 HTTP/1.1 和 HTTP/2,未提及 HTTP/3 或非 HTTP 协议

README 快速开始

piko

简体中文

A small segmented downloader for CLI and Go programs.

piko can save to a file, discard output for speed tests, or return downloaded bytes to your own code. It supports HTTP protocol selection, connection strategies, custom DNS resolvers, proxies, retries, and progress callbacks.

piko currently supports HTTP range/segmented downloads. For ordinary single-stream downloads, use curl instead.

Install

go install github.com/UruhaLushia/piko/cmd/piko@latest

Or download prebuilt binaries from GitHub Releases.

CLI

piko [flags]  [output]

Examples:

# Download with 32 range workers
piko -n 32 -o file.pkg https://example.com/file.pkg

# Always use all 32 workers without adaptive concurrency fallback
piko -n 32 --no-fallback -o file.pkg https://example.com/file.pkg

# Resume an interrupted download
piko -r -o file.pkg https://example.com/file.pkg

# Speed test without saving
piko -n 32 -o NUL https://example.com/file.pkg
piko -n 32 -o /dev/null https://example.com/file.pkg

# Force HTTP/2 or HTTP/1.1
piko --http h2 https://example.com/file.pkg
piko --http h1.1 https://example.com/file.pkg

# Custom request headers
piko -H "Authorization: Bearer token" -H "Accept: application/octet-stream" https://example.com/file.pkg

# Spread parallel dials across resolved IPs (default)
piko -n 32 --connect-strategy round-robin https://example.com/file.pkg

# Race resolved IPs and use the fastest connection
piko -n 32 --connect-strategy fastest https://example.com/file.pkg

# Limit or prefer an IP family
piko -n 32 --ip-family ipv4 https://example.com/file.pkg
piko -n 32 --ip-family prefer-ipv4 https://example.com/file.pkg

# Proxy
piko --proxy http://127.0.0.1:7890 https://example.com/file.pkg
piko --proxy env https://example.com/file.pkg
piko --proxy direct https://example.com/file.pkg

# Custom DNS
piko --dns udp://1.1.1.1 https://example.com/file.pkg
piko --dns dot://cloudflare-dns.com https://example.com/file.pkg
piko --dns https://cloudflare-dns.com/dns-query https://example.com/file.pkg

Config is loaded from ~/.config/piko first, then ~/.piko. Each directory supports config.yaml, config.yml, config.toml, or config.json. CLI flags and positional output override config values.

See examples/config.yaml for a complete config file.

Useful flags:

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

nethical6
精选
nethical6 GitHub avatar

conversation-steganography

A tool that hides encrypted secret messages inside innocent-looking AI-generated chat text for private communication over any messaging platform.

Go
1,149
programmersd21
精选
programmersd21 GitHub avatar

flow

flow is a minimalist terminal dashboard that displays real-time network throughput with smooth animations, multiple responsive modes, and zero configuration.

开发者工具CLI 与终端
277
MobAI-App
MobAI-App GitHub avatar

simslim

simslim reduces iOS simulator memory usage by 4x by disabling unnecessary background daemons, allowing many more simulators to run on a single Mac.

Go
248