TYEclipse/dsh-ipcalc
适用于 DeepSeek Harness 的 IP 与子网数学工具箱:IPv4 子网布局、CIDR 汇总、支持 RFC 5952 规范化和 IANA 分类的 IPv4/IPv6 解析——零依赖。
项目介绍Project Overview
dsh-ipcalc 是 DeepSeek Harness 的 IP 与子网计算插件,提供三个纯本地、零依赖、无网络访问的工具:ipv4_subnet 输出 IPv4 CIDR 的网络号、掩码、广播、主机范围与 IANA 分类;ipv4_summarize 将地址/网段归并为最小覆盖 CIDR;ip_parse 校验并按 RFC 5952 规范化、分类 IPv4/IPv6(含内嵌 IPv4)。适用于需要可靠子网算术、地址归并或地址解析分类时。注意:分类仅覆盖常见 IANA 特殊用途条目,非完整 CIDR 重叠引擎。
dsh-ipcalc is a DeepSeek Harness plugin for IP and subnet math, offering three local, zero-dependency tools with no network I/O. ipv4_subnet returns an IPv4 CIDR's network, netmask, broadcast, host range, counts, and IANA class; ipv4_summarize merges addresses/ranges into the minimal covering CIDR list; ip_parse validates, RFC 5952-normalizes, and classifies IPv4/IPv6 addresses, including embedded IPv4 forms. Use it when agents need reliable subnet arithmetic or address parsing. Caveat: classification covers common IANA registry entries only, not full CIDR-overlap logic.
请帮我了解并安装插件:【dsh-ipcalc】【https://github.com/TYEclipse/dsh-ipcalc】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:TYEclipse/dsh-ipcalc
把 TYEclipse/dsh-ipcalc 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-ipcalc
IP & subnet math toolbox for DeepSeek Harness (dsh). Three pure-math tools — zero runtime dependencies, no network I/O — so agents stop doing subnet arithmetic in their heads (where they frequently get it wrong).
Tools
| Tool | What it does |
|---|---|
ipv4_subnet |
Full subnet layout for an IPv4 CIDR: network, broadcast, netmask, wildcard, host range, address counts, integer forms and IANA classes |
ipv4_summarize |
Reduce a list of IPv4 addresses/ranges to the minimal covering CIDR list (merge + supernet) |
ip_parse |
Validate, normalize (RFC 5952) and classify any IPv4/IPv6 address, including embedded IPv4-in-IPv6 forms |
Install
dsh plugin --profile <your-profile> add github:TYEclipse/dsh-ipcalc
Usage
ipv4_subnet("192.168.1.25/24")
→ network 192.168.1.0/24
netmask 255.255.255.0 wildcard 0.0.0.255 broadcast 192.168.1.255
host range 192.168.1.1 – 192.168.1.254 (254 usable of 256)
classes: network=private host=private
ipv4_subnet("10.10.10.10/255.255.255.248") # dotted-mask input works too
→ network 10.10.10.8/29 (6 usable hosts)
ipv4_summarize(["10.0.0.0/24", "10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"])
→ ["10.0.0.0/22"]
ip_parse("::ffff:192.168.1.1")
→ IPv6, class ipv4_mapped, normalized ::ffff:c0a8:101 (embeds 192.168.1.1)
Semantics
- Exact arithmetic — all math uses plain double arithmetic on 32-bit integers (values up to 2³² are exactly representable), so there is no bitwise-overflow risk.
- /31 follows RFC 3021 — both addresses are reported as usable (point-to-point links).
- /32 is a single host — first/last host equal the address itself.
- Bare addresses are treated as
/32; dotted netmasks (/255.255.255.248) are accepted anywhere a prefix length is; non-contiguous masks are rejected. - RFC 5952 canonicalization — IPv6 is lowercased, leading zeros stripped, and the
longest (leftmost on ties) run of two or more zero hextets compressed to
::. - Classification follows the IANA special-purpose registries:
IPv4
unspecified / broadcast / loopback / private (10/8, 172.16/12, 192.168/16) / cgnat (100.64/10) / link_local (169.254/16) / documentation (192.0.2/24, 198.51.100/24, 203.0.113/24) / multicast (224/4) / reserved (240/4) / global; IPv6unspecified / loopback / ipv4_mapped / ipv4_compatible / documentation (2001:db8::/32) / link_local (fe80::/10) / multicast (ff00::/8) / unique_local (fc00::/7) / global. Classification is best-effort for the common registry entries, not a full CIDR-overlap engine.
Development
pnpm install
pnpm build
pnpm test
pnpm lint
License
MIT
dsh-ipcalc(中文简介)
面向 DeepSeek Harness 的 IP 与子网数学工具箱,三个纯本地计算工具,零运行时依赖、无任何网络访问:
ipv4_subnet:给定 CIDR(支持a.b.c.d/前缀、点分掩码、裸地址)输出完整子网布局——网络号、广播地址、子网掩码、反掩码、可用主机范围与数量、整数形式、IANA 分类(私网/环回/链路本地/CGNAT/文档段/组播/保留段等)。ipv4_summarize:把一组 IPv4 地址/网段归并成最小覆盖 CIDR 列表(相邻合并 + 对齐超网)。ip_parse:校验、规范化(RFC 5952)并分类任意 IPv4/IPv6 地址,识别::ffff:a.b.c.d内嵌 IPv4 形式。
专门解决大模型心算子网边界常出错的问题;/31 遵循 RFC 3021,/32 视为单主机。
nexu-io/open-design
freestylefly/awesome-gpt-image-2
anywhere-labs/dsh-desktop
walkinglabs/learn-harness-engineering
awesome-dsh-plugin/awesome-dsh-plugin
MemTensor/MemOS