fire-scope 0.1.3

This tool is a CLI application and library that collects and aggregates corresponding IP addresses by specifying country codes and AS numbers, and outputs them to a file in TXT or nftables format.It supports RIR file download and whois AS number query, and also has a function to extract overlapping parts of country codes and AS numbers in CIDR units.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::asn::process_as_numbers;
use crate::common::OutputFormat;
use std::error::Error;

/// AS番号リストを受け取り、文字列("ASxxxx") へ変換して実行するラッパ関数。
pub async fn run_as_numbers(
    as_numbers: &[u32],
    mode: &str,
    output_format: OutputFormat,
) -> Result<(), Box<dyn Error + Send + Sync>> {
    // u32 -> "ASxxxx" 形式の文字列へ
    let as_strings: Vec<String> = as_numbers.iter().map(|n| format!("AS{}", n)).collect();

    // asn.rs 内の関数を呼び出す
    process_as_numbers(&as_strings, mode, output_format).await?;
    Ok(())
}