IP address aggregation and expansion
- Go 100%
|
|
||
|---|---|---|
| .claude | ||
| internal/cmd | ||
| .gitignore | ||
| CREDITS | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| README.md | ||
ipa
A small CLI tool for IP address set operations: expand CIDRs, aggregate lists into minimal CIDR blocks, add/merge sets, subtract sets, and visualize bit-level differences between addresses.
Works with both IPv4 and IPv6 (kept strictly separated in output).
Install
go install go.schlittermann.de/heiko/ipa@latest
Or build from source:
git clone https://git.schlittermann.de/heiko/ipa
cd ipa
go build -o ipa .
Commands
| Command | Purpose |
|---|---|
expand |
Expand CIDR ranges into individual IP addresses |
aggregate |
Merge IPs/CIDRs into the smallest equivalent set of prefixes |
add |
Combine multiple IP lists and aggregate the union |
remove |
Subtract IPs/CIDRs of later files from the first file |
diff |
Visualize bit-level differences between two IPs/CIDRs |
Each command reads from STDIN or from files, writes results to STDOUT, and tolerates trailing comments on input lines (only the first whitespace-delimited field is used).
Examples
echo 192.0.2.0/30 | ipa expand
# 192.0.2.0
# 192.0.2.1
# 192.0.2.2
# 192.0.2.3
printf '10.0.0.0/25\n10.0.0.128/25\n' | ipa aggregate
# 10.0.0.0/24
ipa add listA.txt listB.txt
ipa remove all.txt blocked.txt
ipa diff 2001:db8::1 2001:db8::ff
License
Apache-2.0