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
59
README.md
59
README.md
|
|
@ -44,47 +44,50 @@ aquatic-crawler --infohash-source /path/to/info-hash-ipv4.json\
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
-d, --debug <DEBUG>
|
-d, --debug <DEBUG>
|
||||||
Debug level
|
Debug level
|
||||||
|
|
||||||
* `e` - error * `i` - info
|
* `e` - error * `i` - info
|
||||||
|
|
||||||
[default: ei]
|
[default: ei]
|
||||||
|
|
||||||
-c, --clear
|
-c, --clear
|
||||||
Clear previous index collected on crawl session start
|
Clear previous index collected on crawl session start
|
||||||
|
|
||||||
-i, --infohash-source <INFOHASH_SOURCE>
|
-i, --infohash-source <INFOHASH_SOURCE>
|
||||||
Filepath(s) to the Aquatic tracker info-hash JSON/API
|
Filepath(s) to the Aquatic tracker info-hash JSON/API
|
||||||
|
|
||||||
* PR#233 feature
|
* PR#233 feature
|
||||||
|
|
||||||
--torrents-path <TORRENTS_PATH>
|
--torrents-path <TORRENTS_PATH>
|
||||||
Directory path to store the `.torrent` files
|
Directory path to store the `.torrent` files
|
||||||
|
|
||||||
--torrent-tracker <TORRENT_TRACKER>
|
--torrent-tracker <TORRENT_TRACKER>
|
||||||
Define custom tracker(s) to preload the `.torrent` files info
|
Define custom tracker(s) to preload the `.torrent` files info
|
||||||
|
|
||||||
--enable_dht-dht
|
--initial-peers <INITIAL_PEERS>
|
||||||
Enable DHT
|
Define initial peer(s) to preload the `.torrent` files info
|
||||||
|
|
||||||
--enable-upnp-port-forwarding
|
--enable-dht
|
||||||
Enable UPnP
|
Enable DHT resolver
|
||||||
|
|
||||||
--enable-upload
|
--enable-upnp-port-forwarding
|
||||||
Enable upload
|
Enable UPnP
|
||||||
|
|
||||||
--socks-proxy-url <SOCKS_PROXY_URL>
|
--enable-upload
|
||||||
Use `socks5://[username:password@]host:port`
|
Enable upload
|
||||||
|
|
||||||
-s <SLEEP>
|
--socks-proxy-url <SOCKS_PROXY_URL>
|
||||||
Crawl loop delay in seconds
|
Use `socks5://[username:password@]host:port`
|
||||||
|
|
||||||
[default: 300]
|
-s <SLEEP>
|
||||||
|
Crawl loop delay in seconds
|
||||||
|
|
||||||
-h, --help
|
[default: 300]
|
||||||
Print help (see a summary with '-h')
|
|
||||||
|
|
||||||
-V, --version
|
-h, --help
|
||||||
Print version
|
Print help (see a summary with '-h')
|
||||||
|
|
||||||
|
-V, --version
|
||||||
|
Print version
|
||||||
```
|
```
|
||||||
|
|
@ -28,6 +28,10 @@ pub struct Argument {
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub torrent_tracker: Vec<String>,
|
pub torrent_tracker: Vec<String>,
|
||||||
|
|
||||||
|
/// Define initial peer(s) to preload the `.torrent` files info
|
||||||
|
#[arg(long)]
|
||||||
|
pub initial_peers: Vec<String>,
|
||||||
|
|
||||||
/// Enable DHT resolver
|
/// Enable DHT resolver
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
pub enable_dht: bool,
|
pub enable_dht: bool,
|
||||||
|
|
|
||||||
11
src/main.rs
11
src/main.rs
|
|
@ -31,6 +31,11 @@ async fn main() -> anyhow::Result<()> {
|
||||||
trackers.insert(url::Url::from_str(&tracker)?);
|
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
|
// begin
|
||||||
if is_debug_i {
|
if is_debug_i {
|
||||||
debug::info(String::from("Crawler started"));
|
debug::info(String::from("Crawler started"));
|
||||||
|
|
@ -72,6 +77,12 @@ async fn main() -> anyhow::Result<()> {
|
||||||
"magnet:?xt=urn:btih:{i}"
|
"magnet:?xt=urn:btih:{i}"
|
||||||
)),
|
)),
|
||||||
Some(librqbit::AddTorrentOptions {
|
Some(librqbit::AddTorrentOptions {
|
||||||
|
disable_trackers: trackers.is_empty(),
|
||||||
|
initial_peers: if peers.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(peers.clone())
|
||||||
|
},
|
||||||
list_only: true,
|
list_only: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue