bschaatsbergen / cidr

Simplifies IPv4/IPv6 CIDR network prefix management with counting, overlap checking, explanation, and subdivision.
https://formulae.brew.sh/formula/cidr
MIT License
191 stars 9 forks source link

[Feature]: `cidr explain` #63

Closed bschaatsbergen closed 10 months ago

bschaatsbergen commented 11 months ago

We should consider adding a new subcommand: cidr explain to show relevant information about a CIDR range. Think of the explain subcommand as a feature to provide detailed insights into a given CIDR range.

Proposal:

Introduce a new subcommand, explain, to cidr. When users run cidr explain <CIDR>, the tool should output information about the specified CIDR range. This information could for example include:

Network Address: The base IP address of the CIDR range. Subnet Mask: The subnet mask associated with the CIDR range. CIDR Notation: The CIDR notation for the range. Number of Hosts: The total number of usable host addresses within the CIDR range. Usable IP Range: The range of IP addresses that can be assigned to devices on the network. Broadcast Address: The address used to broadcast messages to all devices on the network.

Example Usage:

$ cidr explain 10.0.0.0/16

Network Address:   10.0.0.0
Subnet Mask:       255.255.0.0
CIDR Notation:      /16
Number of Hosts:    65,534
Usable IP Range:    10.0.0.1 to 10.0.255.254
Broadcast Address:  10.0.255.255
bschaatsbergen commented 10 months ago

What I implemented so far in #75: image