mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
add initial_peers argument
This commit is contained in:
parent
2572f0d32e
commit
491f7ef3c4
3 changed files with 46 additions and 28 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -31,6 +31,11 @@ async fn main() -> anyhow::Result<()> {
|
|||
trackers.insert(url::Url::from_str(&tracker)?);
|
||||
}
|
||||
|
||||
let mut peers = Vec::with_capacity(argument.initial_peers.len());
|
||||
for peer in argument.initial_peers {
|
||||
peers.push(std::net::SocketAddr::from_str(&peer)?);
|
||||
}
|
||||
|
||||
// begin
|
||||
if is_debug_i {
|
||||
debug::info(String::from("Crawler started"));
|
||||
|
|
@ -72,6 +77,12 @@ async fn main() -> anyhow::Result<()> {
|
|||
"magnet:?xt=urn:btih:{i}"
|
||||
)),
|
||||
Some(librqbit::AddTorrentOptions {
|
||||
disable_trackers: trackers.is_empty(),
|
||||
initial_peers: if peers.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(peers.clone())
|
||||
},
|
||||
list_only: true,
|
||||
..Default::default()
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue