update
This commit is contained in:
@@ -40,6 +40,8 @@ jobs:
|
||||
run: cargo test --verbose
|
||||
- name: Build examples
|
||||
run: cargo build --examples --verbose
|
||||
- name: Build examples with mimalloc
|
||||
run: cargo build --examples --verbose --features mimalloc
|
||||
|
||||
# 测试不同的 feature 组合
|
||||
test-features:
|
||||
@@ -74,3 +76,10 @@ jobs:
|
||||
else
|
||||
cargo test --verbose --features "${{ matrix.features }}"
|
||||
fi
|
||||
- name: Build examples with features
|
||||
run: |
|
||||
if [ -z "${{ matrix.features }}" ]; then
|
||||
cargo build --examples --verbose
|
||||
else
|
||||
cargo build --examples --verbose --features "${{ matrix.features }}"
|
||||
fi
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dht-crawler"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
edition = "2021"
|
||||
authors = ["桥下红药 <1121744186@qq.com>"]
|
||||
description = "高性能的 Rust DHT(分布式哈希表)爬虫库,用于爬取 BitTorrent DHT 网络中的种子信息"
|
||||
@@ -15,7 +15,7 @@ name = "dht_crawler"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1.35", features = ["full"] }
|
||||
tokio = { version = "1.35", features = ["rt", "rt-multi-thread", "net", "sync", "time", "macros"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_bencode = "0.2"
|
||||
sha1 = "0.10"
|
||||
@@ -24,19 +24,19 @@ rand = "0.8"
|
||||
log = "0.4"
|
||||
thiserror = "1.0"
|
||||
socket2 = { version = "0.5", features = ["all"] }
|
||||
rbit = "0.1"
|
||||
rbit = "0.2"
|
||||
bytes = "1.0"
|
||||
bloomfilter = "1.0"
|
||||
ahash = "0.8"
|
||||
serde_bytes = "0.11.19"
|
||||
mimalloc = { version = "0.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
|
||||
mimalloc = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
mimalloc = ["dep:mimalloc"]
|
||||
mimalloc = []
|
||||
|
||||
[[example]]
|
||||
name = "dht_crawler_example"
|
||||
|
||||
@@ -409,6 +409,7 @@ impl DHTServer {
|
||||
Ok((size, addr)) => {
|
||||
// 🛡️ 安全检查1:拒绝异常大的包(DHT 消息通常 < 2KB)
|
||||
if size > 8192 {
|
||||
#[cfg(debug_assertions)]
|
||||
log::trace!("⚠️ 拒绝异常大的 UDP 包: {} 字节 from {}", size, addr);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user