Skip to content

db757/iptools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iptools (ipt)

A command-line tool for IP address operations and CIDR range manipulations.

Requirements

  • Go 1.24.3 or higher

Installation

Using Go

go install github.com/db757/iptools@latest

Using Nix

nix profile install github:db757/iptools

Building from Source

Using Go

make build

The binary will be created in the dist directory.

Using Nix

make nix-build
make nix-install

The binary will be created in the result/bin directory.

Usage

Check if IP is in Range

ipt inrange [ip] [ranges]

Get CIDR Range Boundaries

ipt cidrange [cidr]

Get Next IP

ipt next [ip]

Get Previous IP

ipt prev [ip]

Get N IPs from CIDR Range

ipt getn [cidr] [count] [--offset|-o offset] [--tail|-t]

Options:

  • --offset, -o: Number of IPs to skip before starting to return results
  • --tail, -t: Count backwards from the end of the range
  • --short, -s: Short output format (global flag)

Development

Available Make Commands

Go Commands

  • make build: Build the project (includes tidy, clean, fmt, vet, test, nix-update)
  • make test: Run tests
  • make fmt: Format code
  • make vet: Run go vet
  • make lint: Run linter
  • make clean: Clean build artifacts
  • make targets: Build for multiple platforms
  • make govulncheck: Run vulnerability checks
  • make upgrade: Upgrade dependencies
  • make run: Run the application (includes vet)

Nix Commands

  • make nix-build: Build using Nix
  • make nix-install: Install to Nix profile
  • make nix-update: Update gomod2nix.toml
  • make nix-shell: Enter Nix development shell

Dependencies

  • github.com/urfave/cli/v3: CLI framework
  • go4.org/netipx: IP address manipulation
  • github.com/stretchr/testify: Testing framework

About

iptools

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors