fire-scope 0.1.7

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
/// 定数の共通化

pub const RIR_URLS: &[&str] = &[
    "https://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-extended-latest",
    "https://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest",
    "https://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-extended-latest",
    "https://ftp.apnic.net/pub/stats/apnic/delegated-apnic-extended-latest",
    "https://ftp.arin.net/pub/stats/arin/delegated-arin-extended-latest",
];

/// ダウンロード本文サイズ上限 (バイト)。防御的に 32 MiB
pub const MAX_RIR_DOWNLOAD_BYTES: u64 = 32 * 1024 * 1024;

/// JSON API 応答の最大サイズ上限 (バイト)。防御的に 8 MiB
pub const MAX_JSON_DOWNLOAD_BYTES: u64 = 8 * 1024 * 1024;