Skip to content

Conversation

@digizeph
Copy link
Member

@digizeph digizeph commented Jan 30, 2026

Summary

Add multi-value OR filters and negation support for parse and search commands, leveraging bgpkit-parser 0.15.0's new filter capabilities.

New Features

Multi-value filters (OR logic)

Filter by multiple values using comma-separated lists. Elements matching ANY of the specified values are included:

# Match elements from any of these origin ASNs
monocle parse file.mrt -o 13335,15169,8075

# Match any of these prefixes
monocle search -t 2024-01-01 -d 1h -p 1.1.1.0/24,8.8.8.0/24

# Match elements from any of these peer ASNs
monocle parse file.mrt -J 174,2914,3356

Negation filters (exclusion)

Exclude elements using the ! prefix:

# Exclude elements from AS13335
monocle parse file.mrt -o '!13335'

# Exclude elements from multiple ASNs (must all be negated)
monocle search -t 2024-01-01 -d 1h -o '!13335,!15169'

# Exclude specific prefixes
monocle parse file.mrt -p '!1.1.1.0/24,!8.8.8.0/24'

Note: Positive and negative values cannot be mixed in the same filter.

Input validation

Added validation with clear error messages:

  • ASN format validation (numeric, optional "AS" prefix)
  • Prefix CIDR notation validation
  • Negation consistency check (cannot mix ! and non-! values)

Breaking Changes

ParseFilters field types changed to support multiple values:

Field Before After
origin_asn Option<u32> Vec<String>
prefix Option<String> Vec<String>
peer_asn Option<u32> Vec<String>

Library users need to update their code:

// Before
let filters = ParseFilters {
    origin_asn: Some(13335),
    ..Default::default()
};

// After
let filters = ParseFilters {
    origin_asn: vec!["13335".to_string()],
    ..Default::default()
};

Other Changes

  • Upgraded bgpkit-parser from 0.13.0 to 0.15.0
  • Refactored feature gates for the database module to simplify conditional compilation

Related issues

#97

- Change ParseFilters fields to Vec<String> for multiple value support
- Support comma-separated values: -o 13335,15169,8075
- Support negation with ! prefix: -o '!13335'
- Add validation for ASN format and prefix CIDR notation
- Upgrade bgpkit-parser to 0.15.0 for OR-logic filter support
- Update examples to use new Vec<String> filter types
- Gate entire database module at lib.rs level with #[cfg(feature = "database")]
- Remove redundant feature gates from internal database submodules
- Add feature gates to config functions that depend on database types
- Re-export RpkiAspaEnrichedRecord and RpkiAspaProviderEnriched
- Update lib.rs doc example to use new Vec<String> filter API
- Add detailed feature documentation to ARCHITECTURE.md
@digizeph digizeph linked an issue Jan 30, 2026 that may be closed by this pull request
@digizeph digizeph merged commit bc668a0 into main Jan 30, 2026
1 check passed
@digizeph digizeph mentioned this pull request Jan 31, 2026
@digizeph digizeph deleted the support-multiple-prefixes branch January 31, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multipe prefixes

1 participant