asn-fetcher-rs
A CLI tool to fetch ASN (Autonomous System Number) information from IP addresses - built with Rust.
About
This tool queries an IP address and retrieves its associated Autonomous System Number (ASN), useful for network administration, security analysis, and understanding internet routing.
Features
- Multiple ASN Data Sources: RIPE NCC API, ipapi.co, and Team Cymru whois support
- IPv4 and IPv6 Support: Query any IP address type
- Fast and Reliable: Built with Rust for performance and safety
- Simple CLI: Easy-to-use command-line interface
Current Status
✅ Fully Functional - ASN lookup with RIPE NCC API, ipapi.co, and Team Cymru whois
Prerequisites
Before you begin, ensure you have Rust installed (1.70 or later):
|
Installation
From Source
# Clone the repository
# Build the project
Usage
Basic Usage
# Using RIPE NCC API (default)
# Using ipapi.co
# Using Team Cymru whois (requires whois command)
# IPv6 support
# Run the optimized binary directly
API Keys
For ipapi.co with higher rate limits, set the IPAPI_API_KEY environment variable:
Development
Running Tests
# Run all tests
# Run tests with output visible
Code Quality
# Format code
# Run linter
# Check formatting
Creating a Release
Use the release script to create a new version:
The release process:
- The script runs quality checks locally
- Creates a version bump commit and tag
- Pushes to GitHub, triggering the CI workflow
- After CI passes, the publish workflow automatically publishes to crates.io
Roadmap
- Create starter CLI template
- Add command-line argument parsing (IP address input)
- Implement ASN lookup using RIPE NCC API
- Add error handling and validation
- Create comprehensive tests
- Support additional ASN data sources (ipapi.co)
- Add configuration file support
- Support additional data sources (team-cymru whois)
- Support MaxMind GeoIP2
- Publish to crates.io
Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and run tests (
cargo test && cargo clippy) - Format your code (
cargo fmt) - Commit your changes
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Thanks to the Rust community for excellent documentation and tools.
Happy Hacking! 🦀🌐