Skip to content

Conversation

Copy link

Copilot AI commented Jan 20, 2026

Enables filtering on multiple values of the same filter type using OR logic. Previously, users could only specify a single value per filter type (except peer_ips).

Changes

New filter variants with OR semantics:

  • origin_asns - comma-separated origin ASNs
  • prefixes, prefixes_super, prefixes_sub, prefixes_super_sub - comma-separated prefixes with match types
  • peer_asns - comma-separated peer ASNs

Implementation:

  • Added Filter::OriginAsns(Vec<u32>), Filter::Prefixes(Vec<IpNet>, PrefixMatchType), Filter::PeerAsns(Vec<u32>) variants
  • Extracted parsing helpers parse_asn_list(), parse_prefix_list(), parse_ip_list() to handle comma-separated values
  • Validation: skips empty strings from consecutive/trailing commas, requires at least one value
  • Matching uses .any() for OR logic within each filter
  • Updated peer_ips to use same validation pattern
  • All new filters support negation with ! prefix

Usage:

// Match elements from ANY of the specified origin ASNs
let parser = BgpkitParser::new(url)
    .add_filter("origin_asns", "13335,15169,8075")
    .unwrap();

// Match elements with ANY of the specified prefixes
let parser = BgpkitParser::new(url)
    .add_filter("prefixes", "1.1.1.0/24,8.8.8.0/24")
    .unwrap();

// Combine filter types (AND between types, OR within)
let parser = BgpkitParser::new(url)
    .add_filter("origin_asns", "13335,15169")  // OR
    .add_filter("type", "a")                    // AND
    .unwrap();

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • spaces.bgpkit.org
    • Triggering command: /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d parser::filter:: /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.3/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8c193fefe02d6c/out/4433246e317b5e42-bignum_deamont_p384_alt.o -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.3/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8c193fefe02d6c/out/4433246e317b5e42-bignum_montinv_p384.o 6.0/generated-include --64 6.0/include -o 6.0/aws-lc/include /tmp/ccPfqY2j.s 6.0/aws-lc/third_party/s2n-bignum/include 193f�� 6.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/include f/aws-lc-sys-0.3-gdwarf-4 6.0/aws-lc/third_party/jitterentropy/jitterentropy-library -1949cf8c6b5b557as -1949cf8c6b5b557-I -1949cf8c6b5b557/home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.3/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8c193fefe02d6c/out/020bc241f4dae036-edwards25519_scalarmulbase_alt.o -1949cf8c6b5b557-I (dns block)
    • Triggering command: /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d parser::filter::tests --destination-port 53 -j ACCEPT f/aws-lc-sys-0.3-gdwarf-4 f/aws-lc-sys-0.3-fno-omit-frame-pointer f/aws-lc-sys-0.3ar -1949cf8c6b5b557cq f/aws-lc-sys-0.3/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8c193fefe02d6c/out/libaws_lc_0_36_0_crypto.a -1949cf8c6b5b557/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8c193fefe02d6c/out/020bc241f4dae036-edwards25519_encode.o f/aw�� f/aws-lc-sys-0.3/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/build/aws-lc-sys-ba8cgit 473964a5e4cb8d lib/rustlib/x86_64-REDACTED-linux-gnu/bin/rust-lld f/aws-lc-sys-0.3iptables f/aws-lc-sys-0.3-w f/aws-lc-sys-0.3-t lib/rustlib/x86_security (dns block)
    • Triggering command: /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d /home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e473964a5e4cb8d parser::filter::tests 473964a5e4cb8d.0fr5y8000t2haei2tun5vv2xu.0i7ocon.rcgu.o 473964a5e4cb8d.0jbwr6vpdjshqogyx6a1rcmk5.0i7ocon.rcgu.o 473964a5e4cb8d.0sqr7g9axebu7k7jnu889mrya.0i7ocon.rcgu.o 473964a5e4cb8d.0ur6uib4xb3tat8jdt2lo6nc8.0i7ocon.rcgu.o 473964a5e4cb8d.0zw06cv0rrsq71kb2k8pgn1tf.0i7ocon.rcgu.o 473964a5e4cb8d.10q0msx0fridp0ws6c8yga6ab.0i7ocon.rcgu.o 473964a5e4cb8d.10y229gwkl76y4yebvkfbdptc.0i7ocon.rcgu.o 473964a5e4cb8d.13s869p76t0rops04paijwfai.0i7ocon.rcgu.o 473964a5e4cb8d.14by1nqxkzjp6erpu76vq2hb4.0i7ocon.rcgu.o 473964a5e4cb8d.14hu5hxone6okpkxvktcz3br2.0i7ocon.rcgu.o 4739�� 473964a5e4cb8d.15t59xk5xxdsd3xqnh96bqxdp.0i7ocon.rcgu.o 473964a5e4cb8d.1gsfupinj8nxwxdsc04inlypk.0i7ocon.rcgu.o /index.crates.io/home/REDACTED/work/bgpkit-parser/bgpkit-parser/target/debug/deps/bgpkit_parser-4e--noprofile orted/include orted/include py-library /index.crates.ioorigin (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Please enable filter to be filtering on multiple filters with the same type with OR logic. For example, if specified multiple prefixes, the filters should return ANY match of the prefixes. The same should goes to origin ASNs or any other types that applies.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 6 commits January 20, 2026 00:55
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Co-authored-by: digizeph <659667+digizeph@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable filtering with multiple entries using OR logic Add OR logic filters for multiple values of same type Jan 20, 2026
Copilot AI requested a review from digizeph January 20, 2026 01:08
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.

2 participants