ipconv

Version, currently 0.3.03 versions

gitlab.com/renich/ipconv

IP address converter CLI. Parse, convert, validate, and classify IPv4 and IPv6 addresses.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  ipconv:
    gitlab: renich/ipconv
    version: ~> 0.3.0

Then run:

shards install

shard.yml

Crystal
>= 1.20.2
License
MIT
Author
Rénich Bon Ćirić
Target
  • ipconv from src/main.cr

Dependencies

Development Dependencies

  • flaw~> 0.1.0github: kdairatchi/flawdev
  • ameba~> 1.6.0github: crystal-ameba/amebadev

README

ipconv

IP address converter CLI — parse, convert, validate, and classify IPv4 and IPv6 addresses.

Features

  • Input auto-detection: Dotted decimal, hex, decimal integer, binary dotted, octal dotted
  • IPv6 support: Expanded, compressed, mixed (IPv4-mapped) notation
  • 6 IPv4 output formats: dotted, hex, hex_dotted, integer, binary, octal
  • 3 IPv6 output formats: expanded, compressed, mixed (IPv4-mapped)
  • 4 serializers: plain (key:value), JSON, YAML, XML
  • Classification: IP class (A–E), 13+ special-purpose ranges per version
  • Auto-detection: Input format is auto-detected — no --from flag needed

Installation

# Build from source
crystal build src/main.cr -o ipconv --release

# Or via make
make

Usage

# Display all formats for an IPv4 address
ipconv 192.168.1.1

# Display a single format
ipconv -f hex 192.168.1.1

# Multiple formats
ipconv -f dotted,hex,integer 192.168.1.1

# JSON output
ipconv -o json 192.168.1.1

# YAML output
ipconv -o yaml 192.168.1.1

# XML output
ipconv -o xml 192.168.1.1

# Pretty-print JSON
ipconv -o json --pretty 192.168.1.1

# IPv6
ipconv 2001:db8::1
ipconv ::ffff:192.168.1.1

Options

FlagDescription
-f, --formatContent format(s): dotted, hex, hex_dotted, integer, binary, octal, expanded, compressed, mixed, class, special
-o, --outputOutput serialization: plain (default), json, yaml, xml
--prettyPretty-print JSON/XML
-h, --helpShow help
-v, --versionShow version

Development

# Run tests
make test

# Or directly
crystal spec

# Build binary
make

# Lint
bin/ameba
bin/flaw scan src/

License

MIT — see LICENSE