geoipsed 0.2.1

Inline decoration of IPv4 and IPv6 address geolocations
Documentation
//! The geoipsed library for IP address extraction and geolocation tagging.
//!
//! This library provides functionality for finding and decorating IP addresses
//! with geolocation information from various MMDB databases.
//!
//! # Examples
//!
//! Creating and registering a custom MMDB provider:
//!
//! ```rust,ignore
//! use geoipsed::{MmdbProvider, ProviderRegistry, TemplateField, template::Template};
//! use std::path::{Path, PathBuf};
//! use anyhow::Result;
//!
//! // Implement the MmdbProvider trait for your custom provider
//! #[derive(Debug)]
//! struct CustomProvider {
//!     name: String,
//!     initialized: bool,
//! }
//!
//! impl MmdbProvider for CustomProvider {
//!     fn name(&self) -> &str {
//!         &self.name
//!     }
//!
//!     fn default_path(&self) -> PathBuf {
//!         PathBuf::from("/path/to/mmdb")
//!     }
//!
//!     fn required_files(&self) -> Vec<String> {
//!         vec!["custom.mmdb".to_string()]
//!     }
//!
//!     fn available_fields(&self) -> Vec<TemplateField> {
//!         vec![
//!             TemplateField {
//!                 name: "ip".to_string(),
//!                 description: "The IP address".to_string(),
//!                 example: "93.184.216.34".to_string(),
//!             },
//!         ]
//!     }
//!
//!     fn initialize(&mut self, _path: &Path) -> Result<()> {
//!         self.initialized = true;
//!         Ok(())
//!     }
//!
//!     fn lookup(
//!         &self,
//!         _ip: std::net::IpAddr,
//!         ip_str: &str,
//!         template: &Template,
//!     ) -> Result<String> {
//!         Ok(template.render(|field| match field {
//!             "ip" => ip_str,
//!             _ => "",
//!         }))
//!     }
//!
//!     fn lookup_and_write(
//!         &self,
//!         wtr: &mut dyn std::io::Write,
//!         _ip: std::net::IpAddr,
//!         ip_str: &str,
//!         template: &Template,
//!     ) -> Result<()> {
//!         template.write(wtr, |out, field| match field {
//!             "ip" => out.write_all(ip_str.as_bytes()),
//!             _ => Ok(()),
//!         })?;
//!         Ok(())
//!     }
//!
//!     fn has_asn(&self, _ip: std::net::IpAddr) -> bool {
//!         false
//!     }
//! }
//!
//! // Register with a registry
//! let mut registry = ProviderRegistry::default();
//! registry.register(
//!     "custom".to_string(),
//!     Box::new(CustomProvider {
//!         name: "My Custom Provider".to_string(),
//!         initialized: false,
//!     })
//! );
//! ```

pub mod error;
pub mod files;
pub mod geoip;
pub mod input;
pub mod mmdb;
pub mod template;

/// Re-export key traits for custom MMDB format support
pub use crate::error::Error;
pub use crate::mmdb::{MmdbProvider, ProviderRegistry, TemplateField};

/// Re-export IP extraction types from the sub-crate
pub use ip_extract::{Extractor, ExtractorBuilder, Tag, Tagged, TextData};