npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ssbun/network-cli

v0.2.0

Published

Check domain registration status and test network connectivity.

Readme

network-cli

面向中国网络环境的轻量命令行工具:查询域名 RDAP 注册状态,并比较境外线路、中国大陆线路及常用站点的连接表现。

npm 包名:@ssbun/network-cli,命令名:network-cli。要求 Node.js 18 或更高版本,无第三方依赖。

安装与使用

npm link

network-cli domain check example.com
network-cli domain check --json 101010.xyz example.com

network-cli ip
network-cli ip --json

network-cli speed
network-cli speed --china-server https://speed.example.com/backend/
network-cli speed --site https://example.com/ --json

域名查询

network-cli domain check 使用 IANA RDAP 服务检查一个或多个域名:

  • registered:RDAP 有注册记录,普通新注册不可买。
  • available:RDAP 返回未找到,通常可作为可注册候选,最终以注册商购物车为准。
  • unknown:RDAP 服务缺失、网络错误或注册局返回异常。

价格和 premium 信息不在 RDAP 中,需要注册商 API。

公网出口信息

network-cli ip 使用旧版 IPInfo API 查询当前公网出口,返回 IP、hostname、城市、省份、国家、经纬度、邮编、时区、ASN 和网络组织。API 实际返回扩展对象时,还会显示:

  • ASN 域名、路由和网络类型(hostingispbusinesseducationgovernment)。
  • anycast、bogon、hosting、VPN、代理、Tor、relay 和隐私服务商。
  • 公司名称/域名/类型、移动运营商、MCC/MNC。
  • 滥用联系人、网络范围和托管域名。

API 缺少的可选字段在 JSON 中为 null。基础匿名响应通常只提供 org,工具会从中拆出 ASN 与名称,但不会根据名称猜测网络类型;文本输出会将网络类型和 hosting 标记为当前响应不可用。

无需配置即可使用;也可以通过可选环境变量提高独立额度:

IPINFO_TOKEN=your_token network-cli ip

Token 只通过 Authorization 请求头发送,不会写入 URL 或结果。扩展字段是否返回取决于 Token 对应的 IPInfo 套餐。城市和经纬度是 IPInfo 根据公网出口作出的近似推断,并非设备的精确物理位置。

网络测速

network-cli speed 默认执行:

  • 自动查询公网出口信息,并写入 JSON 结果的 ipInfo 字段。
  • 通过 Cloudflare 测量境外线路的 HTTP 延迟、下载和上传速度。
  • 探测百度、哔哩哔哩、YouTube、Google 和 GitHub 的可达性、HTTP 状态及响应时间。
  • 未提供中国大陆测速服务器时,将中国大陆结果标记为 skipped

可重复传入 --site <url> 追加绝对 HTTP(S) URL。站点返回 403、404 或 5xx 仍表示网络路径可达;DNS、连接、TLS 或超时错误才标记为不可达。

中国大陆测速服务器

完整的中国大陆上传测速需要允许自动程序上传数据的服务端,因此本工具不会默认使用第三方公共测速站。--china-server 应指向用户有权使用的 LibreSpeed PHP 后端目录:

https://speed.example.com/backend/
├── garbage.php
└── empty.php

例如:

network-cli speed --china-server https://speed.example.com/backend/

耗时与流量

  • 单线路通常需要约 15–30 秒,双线路顺序测速通常需要约 30–60 秒。
  • 双线路完整执行时,协议负载最多约 85 MB,不包含 HTTP/TLS 开销。
  • 高速网络受流量上限影响,精度低于长时间专业测速。
  • 结果只描述到指定 Cloudflare、LibreSpeed 或站点的路径表现,不代表所有互联网目的地或运营商承诺带宽。

输出与退出码

--json 将结构化结果写入 stdout;测速进度写入 stderr,不会破坏 JSON。

人类可读输出在终端中自动使用 ANSI 颜色;--json、管道/重定向和设置 NO_COLOR 环境变量时保持无颜色纯文本:

NO_COLOR=1 network-cli ip
network-cli speed --json > result.json
  • 0:所有已请求线路测速成功;站点不可达不影响退出码。
  • 1:独立 IPInfo 查询失败,或任一已请求线路测速部分失败/全部失败;已有结果仍会输出。
  • 2:未知命令、缺少参数或 URL 无效。

测速中的 IPInfo 查询失败只会在 ipInfo 中记录错误,不改变测速退出码。