• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created about 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CLI to perform various actions on CIDR ranges

cidr

Release GitHub release (latest SemVer) GitHub commits since latest release (by SemVer) Go Reference

CLI to perform various actions on CIDR ranges

Brew

To install cidr using brew, simply run:

brew install cidr

Binaries

You can download the latest binary for Linux, MacOS, and Windows.

Examples

Using cidr is very simple.

Explain a CIDR range

To get more information on a CIDR range:

$ cidr explain 10.0.0.0/16
Base Address:            10.0.0.0
Usable Address Range:    10.0.0.1 to 10.0.255.254
Broadcast Address:       10.0.255.255
Address Count:           65,534
Netmask:                 255.255.0.0 (/16 bits)

This also works with IPv6 CIDR ranges, for example:

$ cidr explain 2001:db8:1234:1a00::/64
Base Address:            2001:db8:1234:1a00::
Usable Address Range:    2001:db8:1234:1a00:: to 2001:db8:1234:1a00:ffff:ffff:ffff:ffff
Address Count:           18,446,744,073,709,551,614
Netmask:                 ffff:ffff:ffff:ffff:: (/64 bits)

Check whether an address belongs to a CIDR range

To check if a CIDR range contains an IP:

$ cidr contains 10.0.0.0/16 10.0.14.5
true

This also works with IPv6 addresses, for example:

$ cidr contains 2001:db8:1234:1a00::/106 2001:db8:1234:1a00::
true

Count distinct host addresses

To get all distinct host addresses part of a given CIDR range:

$ cidr count 10.0.0.0/16
65534

This also works with a IPv6 CIDR range, for example:

$ cidr count 2001:db8:1234:1a00::/106
4194302

Or with a large prefix like a point-to-point link CIDR range:

$ cidr count 172.16.18.0/31
2

CIDR range intersection

To check if a CIDR range overlaps with another CIDR range:

$ cidr overlaps 10.0.0.0/16 10.0.14.0/22
true

This also works with IPv6 CIDR ranges, for example:

$ cidr overlaps 2001:db8:1111:2222:1::/80 2001:db8:1111:2222:1:1::/96
true

Contributing

Contributions are highly appreciated and always welcome. Have a look through existing Issues and Pull Requests that you could help with.

More Repositories

1

terraformbyexample

Terraform by example
HTML
34
star
2

dnsee

See DNS configurations quickly
Go
27
star
3

terraform-gce-atlantis

A set of @hashicorp Terraform configurations for running Atlantis on @googlecloud Compute Engine
HCL
25
star
4

tftag

A DRY approach to tagging Terraform resources
Go
24
star
5

ntest

ntest is a cross-platform cli app that runs multiple tests against any address.
Go
13
star
6

mock

mock is a simple, cross-platform, cli app to simulate HTTP-based APIs.
Go
8
star
7

pre-jitted-lambda-layer

pre-jitting .NET assemblies by wrapping them in a Lambda layer to reduce the cold start latency.
C#
6
star
8

proxying-your-way-into-gke

Securely connect to a Google Kubernetes Engine (GKE) Cluster using Terrafom, SSH and Identity-Aware Proxy.
HCL
5
star
9

dotnet-tf-lambda-example

This repository provides an example on how to setup a very basic .NET Core Lambda Function provisioned by Terraform.
HCL
5
star
10

bschaatsbergen.com

Technical blog maintained by Bruno Schaatsbergen.
HTML
4
star
11

keyless-auth-gcp-hcp-terraform

Keyless Google Cloud Access from HCP Terraform
HCL
4
star
12

aws-detect-root-user-usage

Using EventBridge, SNS and CloudTrail to detect and notify root user usage on your AWS account immediately.
3
star
13

aws-memorydb-cf-template

CloudFormation template to deploy a AWS MemoryDB cluster.
HCL
3
star
14

create

A modern UNIX file generation tool
Go
2
star
15

terraform-aws-go-lambda-packer

Package Go based Lambda functions with a stable hash.
HCL
2
star
16

minimal-terragrunt

Minimal Terragrunt is a highly reduced version of Terragrunt based projects designed to be as simple and cross-translatable as possible.
Go
2
star
17

aws-macie2-slack-notifier

Use Macie to scan S3 buckets for sensitive data or policy issues. Reports findings to Slack through a Lambda.
Python
1
star
18

gcp-github-private-runners

Example configurations to deploy self-hosted GitHub Actions Runners into Google Cloud.
HCL
1
star
19

aws-latency-based-routing-demo

Workshop repository, comparing Route53 its latency based routing policies vs Global Accelerator its edge based routing.
HCL
1
star
20

jenkins-jmeter-automation

Example of automating JMeter loadtests in Jenkins, contains job DSL definitions and container templates.
Groovy
1
star
21

packer-newrelic-ami

Packer template to create an AMI featuring the New Relic agent
HCL
1
star
22

terraform-go-aws-lambda

Package Go based AWS Lambda functions
HCL
1
star
23

terraform-gcp-glb-module

Terraform module to deploy a GCP Global External HTTPS load balancer.
HCL
1
star