🎉 Add Blocklist

Add an implementation of p2p plaintext (and gz compressed) blocklists.
The list can be read from an url or from a file.
All the IP ranges are then stored in interval trees.
This commit is contained in:
Alexander WB 2024-11-18 23:02:52 +01:00
parent fea00e2d18
commit 187ce8c462
4 changed files with 422 additions and 0 deletions

75
Cargo.lock generated
View file

@ -135,6 +135,16 @@ version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
[[package]]
name = "assert-json-diff"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12"
dependencies = [
"serde",
"serde_json",
]
[[package]]
name = "assert_cfg"
version = "0.1.0"
@ -171,6 +181,19 @@ dependencies = [
"syn 2.0.95",
]
[[package]]
name = "async-compression"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df895a515f70646414f4b45c0b79082783b80552b373a68283012928df56f522"
dependencies = [
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
"tokio",
]
[[package]]
name = "async-stream"
version = "0.3.6"
@ -801,6 +824,16 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "colored"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
"lazy_static",
"windows-sys 0.48.0",
]
[[package]]
name = "combine"
version = "4.6.7"
@ -2338,6 +2371,15 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "intervaltree"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "270bc34e57047cab801a8c871c124d9dc7132f6473c6401f645524f4e6edd111"
dependencies = [
"smallvec",
]
[[package]]
name = "ipnet"
version = "2.10.1"
@ -2629,6 +2671,7 @@ dependencies = [
"anyhow",
"arc-swap",
"async-backtrace",
"async-compression",
"async-stream",
"async-trait",
"axum 0.8.1",
@ -2645,6 +2688,7 @@ dependencies = [
"hex 0.4.3",
"home",
"http",
"intervaltree",
"itertools 0.14.0",
"librqbit-bencode",
"librqbit-buffers",
@ -2659,6 +2703,7 @@ dependencies = [
"lru",
"memmap2",
"mime_guess",
"mockito",
"notify",
"parking_lot",
"rand 0.8.5",
@ -3038,6 +3083,30 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "mockito"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "652cd6d169a36eaf9d1e6bce1a221130439a966d7f27858af66a33a66e9c4ee2"
dependencies = [
"assert-json-diff",
"bytes",
"colored",
"futures-util",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-util",
"log",
"rand 0.8.5",
"regex",
"serde_json",
"serde_urlencoded",
"similar",
"tokio",
]
[[package]]
name = "muda"
version = "0.15.3"
@ -4859,6 +4928,12 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "similar"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e"
[[package]]
name = "siphasher"
version = "0.3.11"