mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Merge pull request #179 from greatest-ape/work-2024-01-27
README improvements; fix --no-default-features build errors
This commit is contained in:
commit
f30ab82371
19 changed files with 101 additions and 37 deletions
|
|
@ -46,10 +46,10 @@ the table above.
|
|||
|
||||
## Copyright and license
|
||||
|
||||
Copyright (c) 2020-2023 Joakim Frostegård
|
||||
Copyright (c) Joakim Frostegård
|
||||
|
||||
Distributed under the terms of the Apache 2.0 license. Please refer to the
|
||||
`LICENSE` file in the repository root directory for details.
|
||||
Distributed under the terms of the Apache License, Version 2.0. Please refer to
|
||||
the `LICENSE` file in the repository root directory for details.
|
||||
|
||||
## Trivia
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
# aquatic_bencher
|
||||
|
||||
Automated benchmarking of aquatic and other BitTorrent trackers. Linux only.
|
||||
Automated benchmarking of aquatic and other BitTorrent trackers. Linux only.
|
||||
|
||||
## Supported trackers by protocol
|
||||
|
||||
### UDP
|
||||
|
||||
- [aquatic_udp](https://github.com/greatest-ape/aquatic/)
|
||||
- [opentracker](https://erdgeist.org/arts/software/opentracker/)
|
||||
- [chihaya](https://github.com/chihaya/chihaya)
|
||||
|
|
@ -26,6 +26,7 @@ pub struct SetConfig<C, I> {
|
|||
pub load_test_runs: Vec<(usize, Priority, TaskSetCpuList)>,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn run_sets<C, F, I>(
|
||||
command: &C,
|
||||
cpu_mode: CpuMode,
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@ More benchmark details are available [here](../../documents/aquatic-http-load-te
|
|||
### Compiling
|
||||
|
||||
- Install Rust with [rustup](https://rustup.rs/) (latest stable release is recommended)
|
||||
- Install cmake with your package manager (e.g., `apt-get install cmake`)
|
||||
- Clone this git repository and enter its root directory
|
||||
- Build the application:
|
||||
- Install build dependencies with your package manager (e.g., `apt-get install cmake build-essential`)
|
||||
- Clone this git repository and build the application:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/greatest-ape/aquatic.git && cd aquatic
|
||||
|
||||
# Recommended: tell Rust to enable support for all SIMD extensions present on
|
||||
# current CPU except for those relating to AVX-512. (If you run a processor
|
||||
# that doesn't clock down when using AVX-512, you can enable those instructions
|
||||
|
|
@ -51,7 +52,8 @@ Make necessary adjustments to the file. You will likely want to adjust `address`
|
|||
|
||||
To run over TLS, configure certificate and private key files.
|
||||
|
||||
Running behind a reverse proxy is supported.
|
||||
Running behind a reverse proxy is supported. Please refer to the config file
|
||||
for details.
|
||||
|
||||
### Running
|
||||
|
||||
|
|
@ -83,7 +85,9 @@ configuration files in a similar manner to the tracker application.
|
|||
After starting the tracker, run the load tester:
|
||||
|
||||
```sh
|
||||
./scripts/run-load-test-http.sh
|
||||
. ./scripts/env-native-cpu-without-avx-512 # Optional
|
||||
|
||||
cargo build --release -p aquatic_http_load_test -- --help
|
||||
```
|
||||
|
||||
## Details
|
||||
|
|
@ -107,7 +111,7 @@ fine in production.
|
|||
|
||||
## Copyright and license
|
||||
|
||||
Copyright (c) 2020-2023 Joakim Frostegård
|
||||
Copyright (c) Joakim Frostegård
|
||||
|
||||
Distributed under the terms of the Apache 2.0 license. Please refer to the
|
||||
`LICENSE` file in the repository root directory for details.
|
||||
Distributed under the terms of the Apache License, Version 2.0. Please refer to
|
||||
the `LICENSE` file in the repository root directory for details.
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ impl TorrentMaps {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
pub fn update_torrent_metrics(&self) {
|
||||
self.ipv4.torrent_gauge.set(self.ipv4.torrents.len() as f64);
|
||||
self.ipv6.torrent_gauge.set(self.ipv6.torrents.len() as f64);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ authors.workspace = true
|
|||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
readme = "./README.md"
|
||||
|
||||
[lib]
|
||||
name = "aquatic_http_protocol"
|
||||
|
||||
|
|
|
|||
15
crates/http_protocol/README.md
Normal file
15
crates/http_protocol/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# aquatic_http_protocol: HTTP BitTorrent tracker protocol
|
||||
|
||||
HTTP BitTorrent tracker message parsing and serialization.
|
||||
|
||||
[BEP 003]: https://www.bittorrent.org/beps/bep_0003.html
|
||||
[BEP 007]: https://www.bittorrent.org/beps/bep_0007.html
|
||||
[BEP 023]: https://www.bittorrent.org/beps/bep_0023.html
|
||||
[BEP 048]: https://www.bittorrent.org/beps/bep_0048.html
|
||||
|
||||
Implements:
|
||||
* [BEP 003]: HTTP BitTorrent protocol ([more details](https://wiki.theory.org/index.php/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol)). Exceptions:
|
||||
* Only compact responses are supported
|
||||
* [BEP 023]: Compact HTTP responses
|
||||
* [BEP 007]: IPv6 support
|
||||
* [BEP 048]: HTTP scrape support
|
||||
|
|
@ -6,9 +6,10 @@ authors.workspace = true
|
|||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
readme = "./README.md"
|
||||
|
||||
[lib]
|
||||
name = "aquatic_peer_id"
|
||||
|
||||
|
|
|
|||
3
crates/peer_id/README.md
Normal file
3
crates/peer_id/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# aquatic_peer_id
|
||||
|
||||
Extract BitTorrent client information from announce request peer IDs.
|
||||
|
|
@ -30,11 +30,12 @@ More benchmark details are available [here](../../documents/aquatic-udp-load-tes
|
|||
### Compiling
|
||||
|
||||
- Install Rust with [rustup](https://rustup.rs/) (latest stable release is recommended)
|
||||
- Install cmake with your package manager (e.g., `apt-get install cmake`)
|
||||
- Clone this git repository and enter its root directory
|
||||
- Build the application:
|
||||
- Install build dependencies with your package manager (e.g., `apt-get install cmake build-essential`)
|
||||
- Clone this git repository and build the application:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/greatest-ape/aquatic.git && cd aquatic
|
||||
|
||||
# Recommended: tell Rust to enable support for all SIMD extensions present on
|
||||
# current CPU except for those relating to AVX-512. (If you run a processor
|
||||
# that doesn't clock down when using AVX-512, you can enable those instructions
|
||||
|
|
@ -73,7 +74,9 @@ configuration files in a similar manner to the tracker application.
|
|||
After starting the tracker, run the load tester:
|
||||
|
||||
```sh
|
||||
./scripts/run-load-test-udp.sh
|
||||
. ./scripts/env-native-cpu-without-avx-512 # Optional
|
||||
|
||||
cargo build --release -p aquatic_udp_load_test -- --help
|
||||
```
|
||||
|
||||
## Details
|
||||
|
|
@ -85,7 +88,7 @@ Implements [BEP 015](https://www.bittorrent.org/beps/bep_0015.html) ([more detai
|
|||
|
||||
## Copyright and license
|
||||
|
||||
Copyright (c) 2020-2023 Joakim Frostegård
|
||||
Copyright (c) Joakim Frostegård
|
||||
|
||||
Distributed under the terms of the Apache 2.0 license. Please refer to the
|
||||
`LICENSE` file in the repository root directory for details.
|
||||
Distributed under the terms of the Apache License, Version 2.0. Please refer to
|
||||
the `LICENSE` file in the repository root directory for details.
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ authors.workspace = true
|
|||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
readme = "./README.md"
|
||||
|
||||
[dependencies]
|
||||
aquatic_peer_id.workspace = true
|
||||
|
||||
|
|
|
|||
4
crates/udp_protocol/README.md
Normal file
4
crates/udp_protocol/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# aquatic_udp_protocol: UDP BitTorrent tracker protocol
|
||||
|
||||
[UDP BitTorrent](https://www.bittorrent.org/beps/bep_0015.html) tracker
|
||||
message parsing and serialization.
|
||||
|
|
@ -28,11 +28,12 @@ More details are available [here](../../documents/aquatic-ws-load-test-2023-01-2
|
|||
### Compiling
|
||||
|
||||
- Install Rust with [rustup](https://rustup.rs/) (latest stable release is recommended)
|
||||
- Install cmake with your package manager (e.g., `apt-get install cmake`)
|
||||
- Clone this git repository and enter its root directory
|
||||
- Build the application:
|
||||
- Install build dependencies with your package manager (e.g., `apt-get install cmake build-essential`)
|
||||
- Clone this git repository and build the application:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/greatest-ape/aquatic.git && cd aquatic
|
||||
|
||||
# Recommended: tell Rust to enable support for all SIMD extensions present on
|
||||
# current CPU except for those relating to AVX-512. (If you run a processor
|
||||
# that doesn't clock down when using AVX-512, you can enable those instructions
|
||||
|
|
@ -53,6 +54,8 @@ Generate the configuration file:
|
|||
Make necessary adjustments to the file. You will likely want to adjust `address`
|
||||
(listening address) under the `network` section.
|
||||
|
||||
To run over TLS, configure certificate and private key files.
|
||||
|
||||
Running behind a reverse proxy is supported, as long as IPv4 requests are
|
||||
proxied to IPv4 requests, and IPv6 requests to IPv6 requests.
|
||||
|
||||
|
|
@ -86,7 +89,9 @@ configuration files in a similar manner to the tracker application.
|
|||
After starting the tracker, run the load tester:
|
||||
|
||||
```sh
|
||||
./scripts/run-load-test-ws.sh
|
||||
. ./scripts/env-native-cpu-without-avx-512 # Optional
|
||||
|
||||
cargo build --release -p aquatic_ws_load_test -- --help
|
||||
```
|
||||
|
||||
## Details
|
||||
|
|
@ -102,8 +107,8 @@ fine in production.
|
|||
|
||||
## Copyright and license
|
||||
|
||||
Copyright (c) 2020-2023 Joakim Frostegård
|
||||
Copyright (c) Joakim Frostegård
|
||||
|
||||
Distributed under the terms of the Apache 2.0 license. Please refer to the
|
||||
`LICENSE` file in the repository root directory for details.
|
||||
Distributed under the terms of the Apache License, Version 2.0. Please refer to
|
||||
the `LICENSE` file in the repository root directory for details.
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ use crate::workers::socket::calculate_in_message_consumer_index;
|
|||
use crate::workers::socket::{ip_version_to_metrics_str, WORKER_INDEX};
|
||||
|
||||
/// Optional second tuple field is for peer id hex representation
|
||||
#[cfg(feature = "metrics")]
|
||||
type PeerClientGauge = (Gauge, Option<Gauge>);
|
||||
|
||||
pub struct ConnectionRunner {
|
||||
|
|
@ -68,6 +69,7 @@ impl ConnectionRunner {
|
|||
let clean_up_data = ConnectionCleanupData {
|
||||
announced_info_hashes: Default::default(),
|
||||
ip_version: self.ip_version,
|
||||
#[cfg(feature = "metrics")]
|
||||
opt_peer_client: Default::default(),
|
||||
#[cfg(feature = "metrics")]
|
||||
active_connections_gauge: ::metrics::gauge!(
|
||||
|
|
@ -597,6 +599,7 @@ impl<S: futures::AsyncRead + futures::AsyncWrite + Unpin> ConnectionWriter<S> {
|
|||
struct ConnectionCleanupData {
|
||||
announced_info_hashes: Rc<RefCell<HashMap<InfoHash, PeerId>>>,
|
||||
ip_version: IpVersion,
|
||||
#[cfg(feature = "metrics")]
|
||||
opt_peer_client: Rc<RefCell<Option<PeerClientGauge>>>,
|
||||
#[cfg(feature = "metrics")]
|
||||
active_connections_gauge: Gauge,
|
||||
|
|
|
|||
|
|
@ -240,14 +240,14 @@ async fn clean_connections(
|
|||
}
|
||||
});
|
||||
|
||||
::log::info!(
|
||||
"cleaned connections in worker {}, {} references remaining",
|
||||
WORKER_INDEX.get(),
|
||||
connection_slab.borrow_mut().len()
|
||||
);
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
{
|
||||
::log::info!(
|
||||
"cleaned connections in worker {}, {} references remaining",
|
||||
WORKER_INDEX.get(),
|
||||
connection_slab.borrow_mut().len()
|
||||
);
|
||||
|
||||
// Increment gauges by zero to prevent them from being removed due to
|
||||
// idleness
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ impl TorrentMap {
|
|||
server_start_instant,
|
||||
request_sender_meta,
|
||||
&request,
|
||||
#[cfg(feature = "metrics")]
|
||||
&self.peer_gauge,
|
||||
);
|
||||
|
||||
|
|
@ -260,7 +261,11 @@ impl TorrentMap {
|
|||
|
||||
pub fn handle_connection_closed(&mut self, info_hash: InfoHash, peer_id: PeerId) {
|
||||
if let Some(torrent_data) = self.torrents.get_mut(&info_hash) {
|
||||
torrent_data.handle_connection_closed(peer_id, &self.peer_gauge);
|
||||
torrent_data.handle_connection_closed(
|
||||
peer_id,
|
||||
#[cfg(feature = "metrics")]
|
||||
&self.peer_gauge,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ authors.workspace = true
|
|||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
readme = "./README.md"
|
||||
|
||||
[lib]
|
||||
name = "aquatic_ws_protocol"
|
||||
|
||||
|
|
|
|||
4
crates/ws_protocol/README.md
Normal file
4
crates/ws_protocol/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# aquatic_ws_protocol: WebTorrent tracker protocol
|
||||
|
||||
[WebTorrent](https://github.com/webtorrent) tracker message parsing and
|
||||
serialization.
|
||||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
# aquatic_udp
|
||||
#
|
||||
# Please note that running aquatic_udp under Docker is NOT RECOMMENDED due to
|
||||
# suboptimal performance. This file is provided as a starting point for those
|
||||
# who still wish to do so.
|
||||
#
|
||||
# Customize by setting CONFIG_FILE_CONTENTS and
|
||||
# ACCESS_LIST_CONTENTS environment variables.
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue