diff --git a/Cargo.lock b/Cargo.lock index 171f282..89f5e0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,7 +45,7 @@ checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" [[package]] name = "aquatic" -version = "0.1.0" +version = "0.2.0" dependencies = [ "aquatic_cli_helpers", "aquatic_http", @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "aquatic_cli_helpers" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_toml_config", @@ -69,7 +69,7 @@ dependencies = [ [[package]] name = "aquatic_common" -version = "0.1.0" +version = "0.2.0" dependencies = [ "ahash", "anyhow", @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "aquatic_http" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -119,7 +119,7 @@ dependencies = [ [[package]] name = "aquatic_http_load_test" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -141,7 +141,7 @@ dependencies = [ [[package]] name = "aquatic_http_protocol" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bendy", @@ -162,7 +162,7 @@ dependencies = [ [[package]] name = "aquatic_toml_config" -version = "0.1.0" +version = "0.2.0" dependencies = [ "aquatic_toml_config_derive", "quickcheck", @@ -173,7 +173,7 @@ dependencies = [ [[package]] name = "aquatic_toml_config_derive" -version = "0.1.0" +version = "0.2.0" dependencies = [ "proc-macro2", "quote", @@ -182,7 +182,7 @@ dependencies = [ [[package]] name = "aquatic_udp" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -209,7 +209,7 @@ dependencies = [ [[package]] name = "aquatic_udp_bench" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -228,7 +228,7 @@ dependencies = [ [[package]] name = "aquatic_udp_load_test" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -248,7 +248,7 @@ dependencies = [ [[package]] name = "aquatic_udp_protocol" -version = "0.1.0" +version = "0.2.0" dependencies = [ "byteorder", "either", @@ -258,7 +258,7 @@ dependencies = [ [[package]] name = "aquatic_ws" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -290,7 +290,7 @@ dependencies = [ [[package]] name = "aquatic_ws_load_test" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "aquatic_cli_helpers", @@ -315,7 +315,7 @@ dependencies = [ [[package]] name = "aquatic_ws_protocol" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "criterion", diff --git a/README.md b/README.md index c17cee7..8d01ffe 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ of configuration is: ```toml [access_list] -# Access list mode. Available modes are white, black and off. +# Access list mode. Available modes are allow, deny and off. mode = "off" # Path to access list file consisting of newline-separated hex-encoded info hashes. path = "" diff --git a/aquatic/Cargo.toml b/aquatic/Cargo.toml index 6121da2..f58064d 100644 --- a/aquatic/Cargo.toml +++ b/aquatic/Cargo.toml @@ -1,19 +1,20 @@ [package] name = "aquatic" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "Blazingly fast, multi-threaded BitTorrent tracker (UDP, HTTP, WebTorrent)" repository = "https://github.com/greatest-ape/aquatic" keywords = ["bittorrent", "torrent", "webtorrent"] +readme = "../README.md" [[bin]] name = "aquatic" [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_http = "0.1.0" -aquatic_udp = "0.1.0" -aquatic_ws = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_http = "0.2.0" +aquatic_udp = "0.2.0" +aquatic_ws = "0.2.0" mimalloc = { version = "0.1", default-features = false } diff --git a/aquatic_cli_helpers/Cargo.toml b/aquatic_cli_helpers/Cargo.toml index df80062..64f7a74 100644 --- a/aquatic_cli_helpers/Cargo.toml +++ b/aquatic_cli_helpers/Cargo.toml @@ -1,14 +1,15 @@ [package] name = "aquatic_cli_helpers" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "aquatic BitTorrent tracker CLI helpers" repository = "https://github.com/greatest-ape/aquatic" +readme = "../README.md" [dependencies] -aquatic_toml_config = "0.1.0" +aquatic_toml_config = "0.2.0" anyhow = "1" git-testament = "0.2" diff --git a/aquatic_common/Cargo.toml b/aquatic_common/Cargo.toml index 9e81393..1a1790f 100644 --- a/aquatic_common/Cargo.toml +++ b/aquatic_common/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "aquatic_common" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "aquatic BitTorrent tracker common code" repository = "https://github.com/greatest-ape/aquatic" +readme = "../README.md" [lib] name = "aquatic_common" @@ -14,7 +15,7 @@ name = "aquatic_common" cpu-pinning = ["hwloc", "libc"] [dependencies] -aquatic_toml_config = "0.1.0" +aquatic_toml_config = "0.2.0" ahash = "0.7" anyhow = "1" diff --git a/aquatic_common/src/access_list.rs b/aquatic_common/src/access_list.rs index 2eebc4b..d002d2f 100644 --- a/aquatic_common/src/access_list.rs +++ b/aquatic_common/src/access_list.rs @@ -9,14 +9,14 @@ use arc_swap::{ArcSwap, Cache}; use hashbrown::HashSet; use serde::{Deserialize, Serialize}; -/// Access list mode. Available modes are white, black and off. +/// Access list mode. Available modes are allow, deny and off. #[derive(Clone, Copy, Debug, PartialEq, TomlConfig, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum AccessListMode { /// Only serve torrents with info hash present in file - White, + Allow, /// Do not serve torrents if info hash present in file - Black, + Deny, /// Turn off access list functionality Off, } @@ -74,8 +74,8 @@ impl AccessList { pub fn allows(&self, mode: AccessListMode, info_hash: &[u8; 20]) -> bool { match mode { - AccessListMode::White => self.0.contains(info_hash), - AccessListMode::Black => !self.0.contains(info_hash), + AccessListMode::Allow => self.0.contains(info_hash), + AccessListMode::Deny => !self.0.contains(info_hash), AccessListMode::Off => true, } } @@ -102,8 +102,8 @@ impl AccessListQuery for AccessListArcSwap { fn allows(&self, mode: AccessListMode, info_hash_bytes: &[u8; 20]) -> bool { match mode { - AccessListMode::White => self.load().0.contains(info_hash_bytes), - AccessListMode::Black => !self.load().0.contains(info_hash_bytes), + AccessListMode::Allow => self.load().0.contains(info_hash_bytes), + AccessListMode::Deny => !self.load().0.contains(info_hash_bytes), AccessListMode::Off => true, } } @@ -170,13 +170,13 @@ mod tests { let mut access_list_cache = Cache::new(Arc::clone(&access_list)); - assert!(access_list_cache.load().allows(AccessListMode::White, &a)); - assert!(access_list_cache.load().allows(AccessListMode::White, &b)); - assert!(!access_list_cache.load().allows(AccessListMode::White, &c)); + assert!(access_list_cache.load().allows(AccessListMode::Allow, &a)); + assert!(access_list_cache.load().allows(AccessListMode::Allow, &b)); + assert!(!access_list_cache.load().allows(AccessListMode::Allow, &c)); - assert!(!access_list_cache.load().allows(AccessListMode::Black, &a)); - assert!(!access_list_cache.load().allows(AccessListMode::Black, &b)); - assert!(access_list_cache.load().allows(AccessListMode::Black, &c)); + assert!(!access_list_cache.load().allows(AccessListMode::Deny, &a)); + assert!(!access_list_cache.load().allows(AccessListMode::Deny, &b)); + assert!(access_list_cache.load().allows(AccessListMode::Deny, &c)); assert!(access_list_cache.load().allows(AccessListMode::Off, &a)); assert!(access_list_cache.load().allows(AccessListMode::Off, &b)); @@ -184,7 +184,7 @@ mod tests { access_list.store(Arc::new(AccessList::default())); - assert!(access_list_cache.load().allows(AccessListMode::Black, &a)); - assert!(access_list_cache.load().allows(AccessListMode::Black, &b)); + assert!(access_list_cache.load().allows(AccessListMode::Deny, &a)); + assert!(access_list_cache.load().allows(AccessListMode::Deny, &b)); } } diff --git a/aquatic_http/Cargo.toml b/aquatic_http/Cargo.toml index 4053c12..86b4b5a 100644 --- a/aquatic_http/Cargo.toml +++ b/aquatic_http/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "aquatic_http" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "Blazingly fast, multi-threaded HTTP BitTorrent tracker" repository = "https://github.com/greatest-ape/aquatic" keywords = ["http", "server", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [lib] name = "aquatic_http" @@ -18,10 +19,10 @@ name = "aquatic_http" cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_http_protocol = "0.1.0" -aquatic_toml_config = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_http_protocol = "0.2.0" +aquatic_toml_config = "0.2.0" anyhow = "1" cfg-if = "1" diff --git a/aquatic_http_load_test/Cargo.toml b/aquatic_http_load_test/Cargo.toml index f5413f8..18200ce 100644 --- a/aquatic_http_load_test/Cargo.toml +++ b/aquatic_http_load_test/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "aquatic_http_load_test" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" +description = "BitTorrent (HTTP over TLS) load tester" repository = "https://github.com/greatest-ape/aquatic" keywords = ["http", "benchmark", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [[bin]] name = "aquatic_http_load_test" @@ -14,10 +16,10 @@ name = "aquatic_http_load_test" cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_http_protocol = "0.1.0" -aquatic_toml_config = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_http_protocol = "0.2.0" +aquatic_toml_config = "0.2.0" anyhow = "1" futures-lite = "1" diff --git a/aquatic_http_protocol/Cargo.toml b/aquatic_http_protocol/Cargo.toml index 230f719..440ea54 100644 --- a/aquatic_http_protocol/Cargo.toml +++ b/aquatic_http_protocol/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "aquatic_http_protocol" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" repository = "https://github.com/greatest-ape/aquatic" description = "HTTP BitTorrent tracker protocol" -exclude = ["target"] keywords = ["http", "protocol", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [lib] name = "aquatic_http_protocol" diff --git a/aquatic_toml_config/Cargo.toml b/aquatic_toml_config/Cargo.toml index 3c9e9fb..9ac82ad 100644 --- a/aquatic_toml_config/Cargo.toml +++ b/aquatic_toml_config/Cargo.toml @@ -1,20 +1,20 @@ [package] name = "aquatic_toml_config" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "Serialize toml with comments" repository = "https://github.com/greatest-ape/aquatic" -exclude = ["target"] keywords = ["toml"] +readme = "../README.md" [lib] name = "aquatic_toml_config" [dependencies] toml = "0.5" -aquatic_toml_config_derive = { path = "../aquatic_toml_config_derive" } +aquatic_toml_config_derive = { version = "0.2.0", path = "../aquatic_toml_config_derive" } [dev-dependencies] serde = { version = "1.0", features = ["derive"] } diff --git a/aquatic_toml_config_derive/Cargo.toml b/aquatic_toml_config_derive/Cargo.toml index 3e55d89..d66f3f8 100644 --- a/aquatic_toml_config_derive/Cargo.toml +++ b/aquatic_toml_config_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aquatic_toml_config_derive" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" @@ -8,6 +8,7 @@ description = "Serialize toml with comments" repository = "https://github.com/greatest-ape/aquatic" exclude = ["target"] keywords = ["toml"] +readme = "../README.md" [lib] proc-macro = true diff --git a/aquatic_udp/Cargo.toml b/aquatic_udp/Cargo.toml index c986152..e8b2e8c 100644 --- a/aquatic_udp/Cargo.toml +++ b/aquatic_udp/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "aquatic_udp" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "Blazingly fast, multi-threaded UDP BitTorrent tracker" repository = "https://github.com/greatest-ape/aquatic" keywords = ["udp", "server", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [lib] name = "aquatic_udp" @@ -18,10 +19,10 @@ name = "aquatic_udp" cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_toml_config = "0.1.0" -aquatic_udp_protocol = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_toml_config = "0.2.0" +aquatic_udp_protocol = "0.2.0" anyhow = "1" cfg-if = "1" diff --git a/aquatic_udp_bench/Cargo.toml b/aquatic_udp_bench/Cargo.toml index b7c4bf6..6350d61 100644 --- a/aquatic_udp_bench/Cargo.toml +++ b/aquatic_udp_bench/Cargo.toml @@ -1,20 +1,21 @@ [package] name = "aquatic_udp_bench" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" repository = "https://github.com/greatest-ape/aquatic" +readme = "../README.md" [[bin]] name = "aquatic_udp_bench" [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_toml_config = "0.1.0" -aquatic_udp = "0.1.0" -aquatic_udp_protocol = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_toml_config = "0.2.0" +aquatic_udp = "0.2.0" +aquatic_udp_protocol = "0.2.0" anyhow = "1" crossbeam-channel = "0.5" diff --git a/aquatic_udp_load_test/Cargo.toml b/aquatic_udp_load_test/Cargo.toml index ae803c2..93f5c40 100644 --- a/aquatic_udp_load_test/Cargo.toml +++ b/aquatic_udp_load_test/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "aquatic_udp_load_test" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" +description = "BitTorrent (UDP) load tester" repository = "https://github.com/greatest-ape/aquatic" keywords = ["udp", "benchmark", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [[bin]] name = "aquatic_udp_load_test" @@ -14,10 +16,10 @@ name = "aquatic_udp_load_test" cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_toml_config = "0.1.0" -aquatic_udp_protocol = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_toml_config = "0.2.0" +aquatic_udp_protocol = "0.2.0" anyhow = "1" hashbrown = "0.12" diff --git a/aquatic_udp_protocol/Cargo.toml b/aquatic_udp_protocol/Cargo.toml index 67dda3b..9c99303 100644 --- a/aquatic_udp_protocol/Cargo.toml +++ b/aquatic_udp_protocol/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "aquatic_udp_protocol" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "UDP BitTorrent tracker protocol" repository = "https://github.com/greatest-ape/aquatic" keywords = ["udp", "protocol", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [dependencies] byteorder = "1" diff --git a/aquatic_ws/Cargo.toml b/aquatic_ws/Cargo.toml index 01665d6..af02221 100644 --- a/aquatic_ws/Cargo.toml +++ b/aquatic_ws/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "aquatic_ws" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" description = "Blazingly fast, multi-threaded WebTorrent tracker" repository = "https://github.com/greatest-ape/aquatic" keywords = ["webtorrent", "websocket", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [lib] @@ -19,10 +20,10 @@ name = "aquatic_ws" cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_toml_config = "0.1.0" -aquatic_ws_protocol = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_toml_config = "0.2.0" +aquatic_ws_protocol = "0.2.0" anyhow = "1" async-tungstenite = "0.17" diff --git a/aquatic_ws_load_test/Cargo.toml b/aquatic_ws_load_test/Cargo.toml index af0528e..e6b58d4 100644 --- a/aquatic_ws_load_test/Cargo.toml +++ b/aquatic_ws_load_test/Cargo.toml @@ -1,11 +1,13 @@ [package] name = "aquatic_ws_load_test" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" +description = "WebTorrent over TLS load tester" repository = "https://github.com/greatest-ape/aquatic" keywords = ["webtorrent", "websocket", "benchmark", "torrent", "bittorrent"] +readme = "../README.md" [[bin]] name = "aquatic_ws_load_test" @@ -15,10 +17,10 @@ cpu-pinning = ["aquatic_common/cpu-pinning"] [dependencies] async-tungstenite = "0.17" -aquatic_cli_helpers = "0.1.0" -aquatic_common = "0.1.0" -aquatic_toml_config = "0.1.0" -aquatic_ws_protocol = "0.1.0" +aquatic_cli_helpers = "0.2.0" +aquatic_common = "0.2.0" +aquatic_toml_config = "0.2.0" +aquatic_ws_protocol = "0.2.0" anyhow = "1" futures = "0.3" diff --git a/aquatic_ws_protocol/Cargo.toml b/aquatic_ws_protocol/Cargo.toml index 79be691..fd91881 100644 --- a/aquatic_ws_protocol/Cargo.toml +++ b/aquatic_ws_protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aquatic_ws_protocol" -version = "0.1.0" +version = "0.2.0" authors = ["Joakim Frostegård "] edition = "2021" license = "Apache-2.0" @@ -8,6 +8,7 @@ description = "WebTorrent tracker protocol" repository = "https://github.com/greatest-ape/aquatic" exclude = ["target"] keywords = ["webtorrent", "protocol", "peer-to-peer", "torrent", "bittorrent"] +readme = "../README.md" [lib] name = "aquatic_ws_protocol" diff --git a/documents/aquatic-architecture-2022-02-02.svg b/documents/aquatic-architecture-2022-02-02.svg index 3eb64ee..58fc08c 100644 --- a/documents/aquatic-architecture-2022-02-02.svg +++ b/documents/aquatic-architecture-2022-02-02.svg @@ -1,3 +1,3 @@ -
Socket worker
Socket worker
Socket worker
Socket worker
Responses
Responses
Socket worker
Socket worker
Requests
Requests
Socket
Socket
Request worker
Request worker
Request worker
Request worker
Socket
Socket
Socket
Socket
Responses
Responses
Sharded torrent state
Sharded to...
Sharded torrent state
Sharded to...
  • Establish connections, or in the case of aquatic_udp, validate source IPs
  • Receive and parse requests from peers
  • Run whitelist/blacklist checks
  • Send on announce requests to the responsible request worker
  • Split scrape requests to match state shards and send them to the request workers
  • Receive responses from the request workers, serialize them and send them to peers

Establish connections, or in the case of aqua...
  • Receive announce and scrape requests from the socket workers
  • Update torrent state if appropriate, generate responses
  • Send responses back to the sending socket workers

Receive announce and scrape requests from the...
Connection state
Connection...
Connection state
Connection...
Connection state
Connection...
Requests
Requests
Text is not SVG - cannot display
\ No newline at end of file +
Socket worker
Socket worker
Socket worker
Socket worker
Responses
Responses
Socket worker
Socket worker
Requests
Requests
Socket
Socket
Request worker
Request worker
Request worker
Request worker
Socket
Socket
Socket
Socket
Responses
Responses
Sharded torrent state
Sharded to...
Sharded torrent state
Sharded to...
  • Establish connections, or in the case of aquatic_udp, validate source IPs
  • Receive and parse requests from peers
  • Run access list checks
  • Send on announce requests to the responsible request worker
  • Split scrape requests to match state shards and send them to the request workers
  • Receive responses from the request workers, serialize them and send them to peers

Establish connections, or in the case of aqua...
  • Receive announce and scrape requests from the socket workers
  • Update torrent state if appropriate, generate responses
  • Send responses back to the sending socket workers

Receive announce and scrape requests from the...
Connection state
Connection...
Connection state
Connection...
Connection state
Connection...
Requests
Requests
Text is not SVG - cannot display
\ No newline at end of file