1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Lens module
//!
//! This module provides high-level "lens" abstractions that combine business logic
//! with output formatting. Lenses are designed to be reusable across different
//! interfaces (CLI, REST API, WebSocket, GUI).
//!
//! # Feature Requirements
//!
//! All lenses require the `lib` feature to be enabled.
//!
//! **Quick Guide:**
//! - Need the CLI binary? Use `cli` feature (includes everything)
//! - Need WebSocket server without CLI? Use `server` feature (includes lib)
//! - Need only library/data access? Use `lib` feature (this module)
//!
//! | Lens | Description | Dependencies |
//! |------|-------------|--------------|
//! | `TimeLens` | Time parsing and formatting | chrono, dateparser |
//! | `CountryLens` | Country code/name lookup | bgpkit-commons |
//! | `IpLens` | IP information lookup | ureq, radar-rs |
//! | `ParseLens` | MRT file parsing | bgpkit-parser |
//! | `SearchLens` | BGP message search | bgpkit-broker, bgpkit-parser, rayon |
//! | `RpkiLens` | RPKI validation and data | bgpkit-commons |
//! | `Pfx2asLens` | Prefix-to-ASN mapping | bgpkit-commons, oneio |
//! | `As2relLens` | AS-level relationships | database |
//! | `InspectLens` | Unified AS/prefix lookup | All above |
//!
//! # Architecture
//!
//! Each lens module exports:
//! - A **Lens struct** (e.g., `RpkiLens`, `TimeLens`) - the main entry point for all operations
//! - **Args structs** - input arguments for lens methods
//! - **Output types** - return types and format enums
//!
//! Internal implementation details (helper functions, data loading, API calls) are kept
//! private within each lens module. External users should only interact through the lens.
//!
//! # Usage
//!
//! All lens operations should be performed through the lens struct. Import the
//! specific lens module you need:
//!
//! ```rust,ignore
//! // Time parsing
//! use monocle::lens::time::{TimeLens, TimeParseArgs, TimeOutputFormat};
//!
//! // RPKI validation
//! use monocle::lens::rpki::{RpkiLens, RpkiValidationArgs, RpkiListArgs, RpkiRoaEntry};
//!
//! // IP information
//! use monocle::lens::ip::{IpLens, IpLookupArgs, IpInfo};
//!
//! // Unified AS/prefix inspection
//! use monocle::lens::inspect::{InspectLens, InspectQueryOptions};
//! ```
// =============================================================================
// All lenses (require lib feature)
// =============================================================================
// TimeLens - time parsing and formatting
// CountryLens - country code/name lookup using bgpkit-commons
// IpLens - IP information lookup
// ParseLens - MRT file parsing with bgpkit-parser
// SearchLens - BGP message search across MRT files
// RpkiLens - RPKI validation and data
// Pfx2asLens - prefix-to-ASN mapping
// As2relLens - AS-level relationships
// InspectLens - unified AS and prefix information lookup