Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ripcalc

ripcalc is a Rust-based CLI subnet calculator that builds upon the excellent foundation of sipcalc. While maintaining full compatibility with sipcalc's proven interface and core functionality, ripcalc extends the legacy with modern enhancements and additional features.

Standing on the Shoulders of Giants

sipcalc has been an invaluable tool for network engineers and system administrators for decades. Its simple, reliable interface and comprehensive subnet calculations have made it a cornerstone of network tooling. ripcalc honors this legacy by:

  • Preserving the familiar interface that sipcalc users know and trust
  • Maintaining output compatibility for existing scripts and workflows
  • Building upon proven algorithms that have served the community well

Building Upon sipcalc's Foundation

🎯 Enhanced Precision

  • Modern IPv6 Classifications: Implements current RFC specifications while preserving sipcalc's core functionality
  • Refined Multiple Input Handling: Extends sipcalc's multiple input support with clearer indexing
  • Improved Error Reporting: Provides clearer feedback while maintaining sipcalc's robustness

Extended Capabilities

  • JSON Output Support: Adds structured output format (--json) for modern automation needs
  • Enhanced IPv6 Support: Builds on sipcalc's IPv6 foundation with current RFC classifications
  • Memory-Safe Implementation: Rust foundation provides additional reliability alongside sipcalc's proven algorithms

🏗️ Modern Tooling

  • Active Maintenance: Ongoing development to keep pace with evolving network standards
  • Comprehensive Testing: Extensive test suite including golden tests to ensure compatibility with sipcalc
  • Community-Driven: Built for and by the network engineering community

Evolutionary Enhancements

Aspectsipcalc (Proven Foundation)ripcalc (Building Forward)
IPv6 2001:db8::/32"Aggregatable Global Unicast""Documentation Address" (RFC 3849 specific)
IPv6 2002::/16"Aggregatable Global Unicast""6to4 Transition Address" (RFC 3056 specific)
IPv6 ::1"Reserved" + comment"Loopback Address" (direct classification)
IPv4-mapped IPv6"Reserved""IPv4-mapped IPv6 address" (descriptive)
Error HandlingContinues processingProvides immediate, clear feedback
Multiple InputsIndex displayEnhanced index clarity
Output FormatsText outputText + JSON for automation
InterfaceTime-tested CLIPreserved + extended options

Honoring sipcalc's Legacy

ripcalc exists not to replace sipcalc, but to extend its life and utility into modern networking environments. Every design decision respects sipcalc's proven approach while thoughtfully adding capabilities that today's network professionals need.

This documentation covers installation, usage, detailed examples, and development guidelines for contributing to sipcalc's ongoing legacy.

Installation

Prerequisites

Quick Start

Install from crates.io

# Coming soon - not yet published
cargo install ripcalc

Build from Source (Current Method)

git clone https://github.com/bedecarroll/ripcalc.git
cd ripcalc
cargo build --release

The binary will be available at target/release/ripcalc.

Verify Installation

./target/release/ripcalc --version

Install Manpage (Optional)

# After building, install the manpage system-wide
./scripts/install-manpage.sh

# Or to a custom directory
./scripts/install-manpage.sh ~/.local/share/man/man1

Install Shell Completions (Optional)

# Install completions for all supported shells (bash, zsh, fish)
./scripts/install-completions.sh

# Custom installation directories
BASH_COMP_DIR=~/.local/share/bash-completion/completions ./scripts/install-completions.sh

Supported shells:

  • Bash: Tab completion for all flags and options
  • Zsh: Advanced completion with descriptions
  • Fish: Interactive completion with help text
  • PowerShell: Windows support (completion file generated but install script focuses on Unix shells)

Future Installation Methods

System Package Managers

# Coming soon
brew install ripcalc          # Homebrew (macOS/Linux)
yay -S ripcalc               # Arch Linux (AUR)

Extending sipcalc

If you're currently using sipcalc, ripcalc works seamlessly alongside it:

  1. Build ripcalc using the method above
  2. Preserve existing workflows: Your sipcalc scripts continue to work unchanged
  3. Gradually extend: Use ripcalc for new scripts or enhanced features as needed

Working Together

# Your existing sipcalc workflows remain unchanged
sipcalc 192.168.1.0/24

# ripcalc provides the same core functionality with enhancements
ripcalc 192.168.1.0/24

# Take advantage of ripcalc's extended features when needed
ripcalc --json 192.168.1.0/24  # Structured output for automation

CLI Usage

ripcalc [OPTIONS] [ADDRESS|INTERFACE]...

Options

Core Options

  • -a, --all
    Display all possible information
  • --json
    Output results in JSON format (ripcalc exclusive feature)
  • -d, --resolve
    Enable name resolution
  • -v, --version
    Show version information
  • -h, --help
    Display help information

IPv4 Options

  • -s, --v4split <MASK>
    Split the current network into subnets of MASK size
  • -n, --subnets <NUM>
    Display NUM extra subnets (starting from current subnet)
  • -b, --cidr-bitmap
    CIDR bitmap
  • -c, --classful-addr
    Classful address information
  • -i, --cidr-addr
    CIDR address information (default)
  • -w, --wildcard
    Display information for a wildcard (inverse mask)
  • -x, --classful-bitmap
    Classful bitmap

IPv6 Options

  • -S, --v6split <MASK>
    Split the current network into subnets of MASK size
  • -e, --v4inv6
    IPv4 compatible IPv6 information
  • -r, --v6rev
    IPv6 reverse DNS output
  • -t, --v6-standard
    Standard IPv6 (default)

Input Options

  • -I, --addr-int <INT>
    Add an interface
  • -4, --addr-ipv4 <ADDR>
    Add an IPv4 address
  • -6, --addr-ipv6 <ADDR>
    Add an IPv6 address

Output Options

  • -u, --split-verbose
    Verbose split output

Basic Examples

IPv4 Subnet Calculation

ripcalc 192.168.1.0/24

IPv6 Network Analysis

ripcalc 2001:db8::/48

IPv4 Subnet Splitting

ripcalc -s 26 10.0.0.0/24

IPv6 Subnet Splitting

ripcalc -S 50 2001:db8::/48

Verbose Split Output

ripcalc -u -s 26 10.0.0.0/24

JSON Output (ripcalc exclusive)

ripcalc --json 192.168.1.0/24

Advanced Examples

Multiple Inputs - Enhanced Index Clarity

# ripcalc provides clear index numbering for multiple inputs
# Building on sipcalc's multiple input support
ripcalc 192.168.1.0/24 10.0.0.0/16 172.16.0.0/12

IPv6 Modern Classifications

ripcalc extends sipcalc's solid IPv6 foundation with current RFC-specific classifications:

Documentation Address (RFC 3849)

ripcalc 2001:db8::1
# ripcalc: "Documentation Address" (RFC 3849 specific)
# sipcalc: "Aggregatable Global Unicast Addresses" (general classification)

6to4 Transition Address (RFC 3056)

ripcalc 2002::/16
# ripcalc: "6to4 Transition Address" (RFC 3056 specific)
# sipcalc: "Aggregatable Global Unicast Addresses" (general classification)

Loopback Address (RFC 4291)

ripcalc ::1
# ripcalc: "Loopback Address" (direct classification)
# sipcalc: "Reserved" + "Comment: Loopback" (detailed approach)

IPv4-mapped IPv6 Address

ripcalc ::ffff:192.0.2.1
# ripcalc: "IPv4-mapped IPv6 address" (specific description)
# sipcalc: "Reserved" (general classification)

Enhanced Error Handling

ripcalc builds upon sipcalc's robust validation with more immediate feedback:

Invalid Input Handling

# ripcalc: Provides immediate, clear feedback
ripcalc 999.999.999.999
# Output: Error: Unable to parse '999.999.999.999'

# sipcalc: Attempts graceful continuation with partial processing
# Output: -[int-ipv4 : 999.999.999.999] - 0
#         -[ERR : Unable to retrieve interface information]

Invalid Prefix Length

# ripcalc: Direct error reporting
ripcalc 192.168.1.0/99
# Output: Error: Unable to parse '192.168.1.0/99'

# sipcalc: Continues with available information

JSON Output Feature

ripcalc supports structured JSON output, making it ideal for automation and integration:

ripcalc --json 192.168.1.0/24
{
  "input": "192.168.1.0/24",
  "type": "ipv4",
  "network": "192.168.1.0",
  "netmask": "255.255.255.0",
  "prefix_length": 24,
  "broadcast": "192.168.1.255",
  "host_count": 256,
  "usable_host_count": 254,
  "first_host": "192.168.1.1",
  "last_host": "192.168.1.254"
}

Building on sipcalc's Foundation

ripcalc preserves full compatibility with sipcalc's trusted interface while extending its capabilities:

  • Familiar command-line interface: All sipcalc commands work seamlessly
  • Enhanced output: Builds on sipcalc's reliable calculations with modern RFC classifications
  • Extended functionality: Adds JSON output and additional options while preserving core behavior
  • Proven algorithms: Maintains sipcalc's time-tested calculation methods

Extending sipcalc's Legacy

ripcalc is designed to work alongside sipcalc, extending its proven foundation:

  1. RFC-compliant IPv6 classifications - Building on sipcalc's solid IPv6 support
  2. Enhanced error feedback - Extending sipcalc's validation approach
  3. Improved multiple input handling - Refining sipcalc's multiple input capability
  4. Modern automation support - Adding JSON output for contemporary workflows
  5. Continued development - Maintaining and extending sipcalc's valuable contribution to networking tools

ripcalc and sipcalc: Building Upon Excellence

This page explores how ripcalc builds upon sipcalc's excellent foundation, extending its proven capabilities while honoring its design philosophy and maintaining full compatibility.

Two Tools, Shared Foundation

sipcalc: The Proven Standard

  • Time-tested reliability: Decades of dependable service to the networking community
  • Robust approach: Graceful handling of edge cases and comprehensive subnet calculations
  • Stable interface: Trusted command-line interface that has served countless scripts and workflows
  • Comprehensive IPv6 support: Solid foundation for modern IPv6 networking

ripcalc: Building Forward

  • Honoring the foundation: Preserves sipcalc's proven algorithms and interface design
  • Extending capabilities: Adds modern features while maintaining compatibility
  • RFC evolution: Implements current standards while respecting sipcalc's solid base
  • Community continuity: Ensures sipcalc's valuable contribution continues to serve future networking needs

Detailed Feature Comparison

1. IPv6 Address Classification

Documentation Address Range (2001:db8::/32)

RFC 3849 defines 2001:db8::/32 specifically for documentation examples.

# Command
ripcalc 2001:db8::1
ToolOutputAssessment
sipcalcAggregatable Global Unicast AddressesGeneral classification (following original IPv6 standards)
ripcalcDocumentation AddressRFC 3849 specific classification

ripcalc enhancement: Provides specific RFC 3849 context, building on sipcalc's solid IPv6 foundation to offer more precise classification for documentation ranges.

6to4 Transition Address Range (2002::/16)

RFC 3056 defines 2002::/16 for 6to4 IPv6-over-IPv4 transition mechanism.

# Command  
ripcalc 2002::/16
ToolOutputAssessment
sipcalcAggregatable Global Unicast AddressesGeneral classification (consistent with original IPv6 approach)
ripcalc6to4 Transition AddressRFC 3056 specific classification

ripcalc enhancement: Extends sipcalc's reliable IPv6 support with specific transition mechanism identification.

Loopback Address (::1)

RFC 4291 defines ::1 as the IPv6 loopback address.

# Command
ripcalc ::1
ToolOutputAssessment
sipcalcReserved
Comment: Loopback
Detailed approach with classification and explanation
ripcalcLoopback AddressDirect classification approach

ripcalc approach: Streamlines sipcalc's thorough information into a single, clear classification.

IPv4-mapped IPv6 Addresses (::ffff:0:0/96)

RFC 4291 defines IPv4-mapped IPv6 addresses for dual-stack compatibility.

# Command
ripcalc ::ffff:192.0.2.1
ToolOutputAssessment
sipcalcReservedGeneral classification approach
ripcalcIPv4-mapped IPv6 addressDescriptive classification

ripcalc enhancement: Builds on sipcalc's solid IPv6 parsing with more descriptive classification of dual-stack addressing.

2. Error Handling Approaches

Invalid IPv4 Octets

# Command with impossible IPv4 values
ripcalc 999.999.999.999
ToolBehaviorAssessment
sipcalcGraceful continuation:
-[int-ipv4 : 999.999.999.999] - 0
-[ERR : Unable to retrieve interface information]
Attempts to provide available information
ripcalcImmediate feedback:
Error: Unable to parse '999.999.999.999'
Direct error reporting

ripcalc approach: Builds on sipcalc's robust validation with immediate feedback, helping users quickly identify input issues.

Invalid IPv4 Prefix Length

# Command with impossible prefix length
ripcalc 192.168.1.0/99
ToolBehaviorAssessment
sipcalcGraceful handling with error informationContinues processing where possible
ripcalcError: Unable to parse '192.168.1.0/99'Immediate error identification

ripcalc approach: Extends sipcalc's validation approach with immediate problem identification.

3. Multiple Input Handling

Index Numbering Enhancement

# Command with multiple different inputs
ripcalc 192.168.1.0/24 10.0.0.0/16 172.16.0.0/12
ToolIndex DisplayAssessment
sipcalcConsistent index displayUses unified indexing approach
ripcalcShows - 0, - 1, - 2Clear sequential indexing

ripcalc enhancement: Builds on sipcalc's multiple input support with enhanced index clarity for easier result identification.

4. Address Calculation Differences

Network Address Count for /0 Networks

# Command with entire IPv4 space
ripcalc 192.168.1.1/0
ToolAddress CountAssessment
sipcalc4294967295 (2^32 - 1)Traditional calculation excluding network/broadcast
ripcalc4294967296 (2^32)Modern calculation including all addresses

ripcalc enhancement: Provides mathematically correct 2^32 calculation for the complete IPv4 address space, rather than applying network/broadcast exclusions inappropriately to /0 networks.

Single Host Networks

# Command with single host
ripcalc 255.255.255.255/32
ToolUsable RangeAssessment
sipcalcShows usable range calculationsMay show invalid ranges for single hosts
ripcalcAccurate single host handlingDoesn't show invalid usable ranges

ripcalc enhancement: Correctly handles edge cases where traditional network calculations don't apply, providing more accurate information for single-host networks.

5. Extended Capabilities

JSON Output Support

# Structured output for automation
ripcalc --json 192.168.1.0/24
ToolSupportAssessment
sipcalcText output focusProven text-based interface
ripcalcText + JSON supportExtends sipcalc's interface with structured output

ripcalc addition: Adds modern JSON output capability while preserving sipcalc's trusted text interface.

5. Development Approaches

Aspectsipcalcripcalc
FoundationMature, stable codebaseBuilds on sipcalc's proven foundation
LanguageC (proven reliability)Rust (memory safety + performance)
InterfaceTime-tested designPreserves sipcalc's trusted interface
StandardsSolid IPv6/IPv4 supportExtends with current RFC compliance
CommunityEstablished user baseContinues sipcalc's community service

Working Together

Seamless Transition

ripcalc works as a natural extension of sipcalc:

# Your existing sipcalc workflows work unchanged
sipcalc 192.168.1.0/24

# ripcalc provides the same results with enhancements
ripcalc 192.168.1.0/24

Extended Capabilities

Take advantage of ripcalc's additional features:

# Enhanced IPv6 classifications
ripcalc 2001:db8::/48  # Shows "Documentation Address" specificity

# Modern automation support
ripcalc --json 192.168.1.0/24 | jq '.network'

# Clear error feedback
ripcalc 999.999.999.999  # Immediate error identification

Thoughtful Enhancement

ripcalc's approach to extending sipcalc:

# Preserves sipcalc's proven calculation methods
# Maintains familiar command-line interface
# Adds modern features without breaking existing workflows
# Provides enhanced feedback while respecting sipcalc's design philosophy

Continuing sipcalc's Legacy

  1. Foundation Respect: Built on sipcalc's proven algorithms and design philosophy
  2. Interface Preservation: Maintains the trusted command-line interface that users rely on
  3. Enhanced Precision: Extends IPv6 classifications with current RFC specifications
  4. Modern Integration: Adds JSON support for contemporary automation needs
  5. Community Continuity: Ensures sipcalc's valuable contribution continues serving the networking community

ripcalc represents the natural evolution of sipcalc's excellent foundation - honoring its legacy while extending its utility for modern networking environments.

Module Overview

This section provides a high-level overview of the code modules in src/.

  • main.rs
    CLI entry point (argument parsing and dispatch).
  • ipv4.rs
    IPv4 parsing and network calculations.
  • ipv6.rs
    IPv6 parsing and network calculations.
  • dns.rs
    DNS hostname resolution utilities.
  • interface.rs
    Local network interface enumeration and information.
  • output.rs
    Formatting and printing logic (text and JSON).
  • tests/integration_tests.rs
    End-to-end integration tests for CLI behavior.

Development Workflow

This project maintains clippy compliance at nursery level (the highest available) and requires all steps to pass with zero warnings before pushing changes.

Standard Development Process

  1. Format: cargo fmt --all

  2. Lint (Comprehensive): cargo clippy --all-targets -- -D warnings -W clippy::pedantic -W clippy::nursery

    • Code Quality Standard: Maintains clippy compliance at nursery level
    • No #[allow] bypasses for actual issues - fix the underlying problem instead
    • The only allowed bypass: #[allow(dead_code)] for intentionally unused but documented code
  3. Build: cargo build --all-targets

  4. Test: cargo test

  5. Golden tests: cargo test --test golden_compare

    • Verifies output parity with sipcalc while accounting for our documented improvements
  6. Documentation: cargo doc --open

  7. Markdown lint: markdownlint-cli2 "**/*.md"

  8. Commit messages: Follow the Conventional Commits specification.

All steps must pass with zero warnings before pushing changes.

Testing Strategy

Golden Test Files Protection

tests/sipcalc_golden/ contains ONLY genuine sipcalc output - NEVER ripcalc output!

Strict Rules for Golden Files

  1. ONLY sipcalc output - Never add ripcalc output to this directory
  2. NO ripcalc-specific features - JSON, modern IPv6 classifications, etc. don't belong here
  3. Never edit existing golden files - they preserve exact sipcalc behavior
  4. Generation command: sipcalc <args> > tests/sipcalc_golden/<name>.txt

Testing Strategy by Feature Type

Feature TypeTest LocationGolden Files?Purpose
sipcalc compatibilitytests/golden_compare.rs::compare_with_golden_outputs()✅ YesExact output matching
ripcalc improvementstests/golden_compare.rs::test_ripcalc_improvements()❌ NoDocument intentional differences
ripcalc-only featurestests/golden_compare.rs::test_json_output()❌ NoValidate ripcalc functionality
Modern IPv6 classificationtests/golden_compare.rs::test_modern_ipv6_classification()❌ NoDocument modernization

Features That Should NOT Have Golden Files

  • JSON output - ripcalc-specific feature (sipcalc doesn't support JSON)
  • Modern IPv6 address types - ripcalc uses RFC-compliant terminology vs sipcalc's 1990s terms
  • Correct multiple input indexing - ripcalc fixes sipcalc's indexing bug
  • Wildcard mode variations - ripcalc's implementation differs intentionally
  • Verbose split differences - different output format by design

Code Quality Guidelines

  • Clippy Level: Maintain nursery + pedantic + all lint compliance
  • Unused Code: Remove unused code rather than ignoring with _ prefixes
  • Documentation: Use proper backticks around code in doc comments
  • Function Length: Keep functions under 100 lines (split large functions into helpers)
  • Self Usage: Use Self instead of repeating type names
  • Const Functions: Make functions const where possible for compile-time evaluation

Contributing

Before submitting changes:

  1. Run the complete development workflow above
  2. Ensure all tests pass including golden tests
  3. Update documentation if adding new features
  4. Follow conventional commit message format

Packaging ripcalc

This document provides guidance for package maintainers who want to create distribution packages for ripcalc.

Package Information

  • Name: ripcalc
  • Description: A Rust-based subnet calculator that replicates and extends sipcalc functionality
  • License: MIT
  • Homepage: https://github.com/bedecarroll/ripcalc
  • Documentation: https://ripcalc.bedecarroll.com

Build Requirements

Runtime Dependencies

  • None (statically linked Rust binary)

Build Dependencies

  • Rust toolchain (1.70+)
  • Cargo
  • Standard build tools (make, gcc/clang for some dependencies)

Build Process

Standard Build

cargo build --release

With Manpage Generation

The manpage is automatically generated during the build process using clap_mangen. The generated manpage will be available at:

target/release/build/ripcalc-*/out/man/ripcalc.1

Cross-compilation Support

ripcalc supports cross-compilation for various targets:

# Example for musl
cargo build --release --target x86_64-unknown-linux-musl

Installation Layout

Binary

  • Location: /usr/bin/ripcalc (or /usr/local/bin/ripcalc)
  • Permissions: 755

Manpage

  • Location: /usr/share/man/man1/ripcalc.1 (or /usr/local/share/man/man1/ripcalc.1)
  • Permissions: 644
  • Source: Auto-generated during build in target/release/build/ripcalc-*/out/man/ripcalc.1

Shell Completions

  • Bash: /usr/share/bash-completion/completions/ripcalc
  • Zsh: /usr/share/zsh/site-functions/_ripcalc
  • Fish: /usr/share/fish/vendor_completions.d/ripcalc.fish
  • PowerShell: ripcalc.ps1 (for Windows packages)
  • Permissions: 644
  • Source: Auto-generated during build in target/release/build/ripcalc-*/out/completions/

Documentation (Optional)

  • Location: /usr/share/doc/ripcalc/
  • Files: README.md, LICENSE, CHANGELOG.md (if available)

Package-Specific Notes

Debian/Ubuntu (.deb)

# Build dependencies
Build-Depends: cargo, rustc (>= 1.70), pkg-config

# Runtime dependencies (none - statically linked)
Depends: ${shlibs:Depends}, ${misc:Depends}

# Package description
Description: Rust-based subnet calculator extending sipcalc functionality
 ripcalc is a modern subnet calculator that builds upon the excellent
 foundation of sipcalc. It maintains full compatibility with sipcalc's
 proven interface while adding modern enhancements including JSON output,
 enhanced IPv6 support with current RFC classifications, and improved
 error handling.

Red Hat/Fedora (.rpm)

Name:           ripcalc
Version:        0.1.0
Release:        1%{?dist}
Summary:        Rust-based subnet calculator extending sipcalc functionality
License:        MIT
URL:            https://github.com/bedecarroll/ripcalc
Source0:        %{name}-%{version}.tar.gz

BuildRequires:  cargo
BuildRequires:  rust >= 1.70

%description
ripcalc is a modern subnet calculator that builds upon the excellent
foundation of sipcalc. It maintains full compatibility with sipcalc's
proven interface while adding modern enhancements including JSON output,
enhanced IPv6 support with current RFC classifications, and improved
error handling.

%build
cargo build --release

%install
install -D -m 755 target/release/ripcalc %{buildroot}%{_bindir}/ripcalc
install -D -m 644 target/release/build/ripcalc-*/out/man/ripcalc.1 %{buildroot}%{_mandir}/man1/ripcalc.1
install -D -m 644 target/release/build/ripcalc-*/out/completions/ripcalc.bash %{buildroot}%{_datadir}/bash-completion/completions/ripcalc
install -D -m 644 target/release/build/ripcalc-*/out/completions/_ripcalc %{buildroot}%{_datadir}/zsh/site-functions/_ripcalc
install -D -m 644 target/release/build/ripcalc-*/out/completions/ripcalc.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/ripcalc.fish

%files
%license LICENSE
%doc README.md
%{_bindir}/ripcalc
%{_mandir}/man1/ripcalc.1*
%{_datadir}/bash-completion/completions/ripcalc
%{_datadir}/zsh/site-functions/_ripcalc
%{_datadir}/fish/vendor_completions.d/ripcalc.fish

Arch Linux (PKGBUILD)

# Maintainer: Package Maintainer <email@domain.com>
pkgname=ripcalc
pkgver=0.1.0
pkgrel=1
pkgdesc="Rust-based subnet calculator extending sipcalc functionality"
arch=('x86_64')
url="https://github.com/bedecarroll/ripcalc"
license=('MIT')
depends=()
makedepends=('cargo' 'rust')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
    cd "$pkgname-$pkgver"
    cargo build --release --locked
}

package() {
    cd "$pkgname-$pkgver"
    install -Dm755 target/release/ripcalc "$pkgdir/usr/bin/ripcalc"
    install -Dm644 target/release/build/ripcalc-*/out/man/ripcalc.1 "$pkgdir/usr/share/man/man1/ripcalc.1"
    install -Dm644 target/release/build/ripcalc-*/out/completions/ripcalc.bash "$pkgdir/usr/share/bash-completion/completions/ripcalc"
    install -Dm644 target/release/build/ripcalc-*/out/completions/_ripcalc "$pkgdir/usr/share/zsh/site-functions/_ripcalc"
    install -Dm644 target/release/build/ripcalc-*/out/completions/ripcalc.fish "$pkgdir/usr/share/fish/vendor_completions.d/ripcalc.fish"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}

Alpine Linux (APKBUILD)

# Maintainer: Package Maintainer <email@domain.com>
pkgname=ripcalc
pkgver=0.1.0
pkgrel=0
pkgdesc="Rust-based subnet calculator extending sipcalc functionality"
url="https://github.com/bedecarroll/ripcalc"
arch="all"
license="MIT"
makedepends="cargo"
source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"

build() {
    cargo build --release --locked
}

check() {
    cargo test --release --locked
}

package() {
    install -Dm755 target/release/ripcalc "$pkgdir"/usr/bin/ripcalc
    install -Dm644 target/release/build/ripcalc-*/out/man/ripcalc.1 "$pkgdir"/usr/share/man/man1/ripcalc.1
    install -Dm644 target/release/build/ripcalc-*/out/completions/ripcalc.bash "$pkgdir"/usr/share/bash-completion/completions/ripcalc
    install -Dm644 target/release/build/ripcalc-*/out/completions/_ripcalc "$pkgdir"/usr/share/zsh/site-functions/_ripcalc
    install -Dm644 target/release/build/ripcalc-*/out/completions/ripcalc.fish "$pkgdir"/usr/share/fish/vendor_completions.d/ripcalc.fish
}

Testing Package Builds

Test Installation

# After package installation, verify:
ripcalc --version
man ripcalc
ripcalc 192.168.1.0/24
ripcalc --json 192.168.1.0/24

# Test shell completions
ripcalc --<TAB>    # Should show available flags
ripcalc -<TAB>     # Should show short options

Compatibility Testing

# Test sipcalc compatibility (if sipcalc is available)
ripcalc 192.168.1.0/24 > ripcalc_output.txt
sipcalc 192.168.1.0/24 > sipcalc_output.txt
# Compare outputs (accounting for known improvements)

Distribution-Specific Considerations

File Conflicts

  • ripcalc should not conflict with sipcalc packages
  • Both tools can be installed simultaneously
  • Consider adding "Suggests: sipcalc" for compatibility testing

Security

  • ripcalc is a network analysis tool (similar to sipcalc)
  • No special permissions required
  • Static binary with no external runtime dependencies

Documentation

  • Include README.md and LICENSE in package documentation
  • Consider including example usage in package description
  • Link to full documentation at https://ripcalc.bedecarroll.com

Support

For packaging questions or issues:

  1. Check existing issues at https://github.com/bedecarroll/ripcalc/issues
  2. Review the development documentation in the repository
  3. Create new issues for packaging-specific problems

Version Updates

ripcalc follows semantic versioning. Package maintainers should:

  1. Monitor releases at https://github.com/bedecarroll/ripcalc/releases
  2. Test compatibility with existing workflows
  3. Update package descriptions for new features as appropriate

License

This project is licensed under the MIT License.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For the complete license text, see the LICENSE file in the repository.