speedtest

August 26, 2026 · View on GitHub

Hits

Build and Release

就近节点测速模块

说明

  • 基于speedtest.net-爬虫speedtest.cn-爬虫的数据
  • 基于speedtest-go二次开发,go原生实现就近测速无需使用shell命令
  • 已适配 speedtest-go v1.8.2:用户配置请求使用随机缓存旁路参数,避免共享 CDN 返回其他客户端的配置
  • -dns-mode=auto 在本地 DNS 被独立探测确认失效时,仅在当前进程中选择最低延迟的内置 DoH/DoT;瞬时网络错误不会改变系统解析路径
  • 主体逻辑借鉴了ecsspeed
  • 使用shell命令使用speedtest进行测速

TODO

  • 添加对泰尔测速的支持

下载speedtest或speedtest-go

目前默认安装官方的speedtest包

curl https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh -sSf | bash

curl https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh -sSf | bash

使用

下载及安装

curl https://raw.githubusercontent.com/oneclickvirt/speedtest/main/spt_install.sh -sSf | bash

curl https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/speedtest/main/spt_install.sh -sSf | bash

使用

spt

./spt

进行测试

无环境依赖,理论上适配所有系统和主流架构,更多架构请查看 https://github.com/oneclickvirt/speedtest/releases

Usage: spt [options]
  -e    Enable logging
  -h    Show help information
  -l string
        Language parameter (options: en, zh) (default "zh")
  -m string
        Test Method parameter (options: origin, speedtest, speedtest-go) (default "speedtest")
  -dns-mode string
        DNS mode (auto, system, doh, or dot) (default "auto")
  -nearby
        Test only nearby servers
  -num int
        Number of test servers, default -1 not to limit (default -1)
  -opt string
        Operator parameter (options: cmcc, cu, ct, sg, tw, jp, hk, global) (default "global")
  -pf string
        Platform parameter (options: net, cn) (default "net")
  -s    Show head (default true)
  -v    Show version information

卸载

rm -rf /root/spt
rm -rf /usr/bin/spt

在Golang中使用

go get github.com/oneclickvirt/speedtest@v0.0.25