Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. cidranger

cidranger

MITGo

A high-performance Go library for fast IP address to CIDR block lookups using a path-compressed trie.

GitHubGitHub
969 stars110 forks0 contributors

What is cidranger?

Cidranger is a Go library designed for fast IP address to CIDR block lookups. It solves the problem of efficiently determining whether an IP address belongs to any predefined network ranges, such as those from cloud providers like AWS, using an optimized trie data structure. This is crucial for applications in network security, routing, and IP geolocation.

Target Audience

Go developers building network-aware applications, such as cloud service tools, firewalls, load balancers, or any system requiring rapid IP range checks.

Value Proposition

Developers choose Cidranger for its exceptional performance, with lookup times in nanoseconds, and its efficient memory usage due to path compression. It offers a clean, idiomatic Go API and supports both IPv4 and IPv6, making it a robust alternative to slower brute-force approaches.

Overview

Fast IP to CIDR lookup in Golang

Use Cases

Best For

  • Checking if an IP address belongs to published cloud provider CIDR blocks (e.g., AWS, Google Cloud)
  • Implementing IP-based routing rules in networking applications
  • Building security tools that filter or log traffic based on IP ranges
  • Optimizing performance-critical IP lookup operations in Go services
  • Handling large datasets of CIDR blocks efficiently
  • Developing network monitoring or analysis tools with dual-stack (IPv4/IPv6) support

Not Ideal For

  • Applications not written in Go that require cross-platform compatibility.
  • Projects needing complex CIDR algebra such as merging overlapping ranges or calculating subnet differences.
  • Systems with extremely small, static IP lists where a brute-force approach is sufficient and simpler.
  • Dynamic environments with very frequent changes to the CIDR set, where insertion/deletion performance is critical and not highlighted as a strength.

Pros & Cons

Pros

Nanosecond Lookup Speed

Benchmarks show IPv4 lookups in 353 ns and IPv6 in 143 ns with AWS ranges, drastically outperforming brute-force methods.

Memory Efficient Trie

Uses path compression to minimize trie depth and size, reducing memory footprint as visualized in the README examples.

Dual-Stack IP Support

Handles both IPv4 and IPv6 CIDR blocks within the same data structure, enabling seamless integration for modern networks.

Custom Data Attachment

Allows extending entries via the RangerEntry interface to store metadata like geolocation or service tags, enhancing flexibility.

Cons

Limited CIDR Manipulation

Focuses solely on containment lookups; lacks built-in functions for CIDR operations like merging, splitting, or overlap calculations.

Basic Documentation Scope

README provides core examples but lacks tutorials on advanced topics such as concurrency handling, persistence, or error management in edge cases.

Standalone Library Overhead

Not integrated with broader Go networking ecosystems, potentially requiring additional effort for features like serialization or integration with other tools.

Frequently Asked Questions

Quick Stats

Stars969
Forks110
Contributors0
Open Issues4
Last commit2 years ago
CreatedSince 2017

Tags

#trie#ip#golang-library#ipv4#network-analysis#cloud-networking#go#ipv6

Built With

G
Go

Included in

Go169.1k
Auto-fetched 1 day ago

Related Projects

fasthttpfasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

Stars23,347
Forks1,817
Last commit2 days ago
webrtcwebrtc

Pure Go implementation of the WebRTC API

Stars16,260
Forks1,839
Last commit2 days ago
kcptunkcptun

Reliable UDP Transmission Optimizer based on KCP: Enhancing network efficiency in poor connectivity environments.

Stars14,403
Forks2,631
Last commit23 days ago
cloudflaredcloudflared

Cloudflare Tunnel client

Stars14,028
Forks1,264
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub