diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 11d11a5c..934a43eb 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ "streetsidesoftware.code-spell-checker", - "rust-lang.rust-analyzer" + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 3bf0969e..661243fb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,4 +20,9 @@ "-W", "clippy::pedantic", ], + "evenBetterToml.formatter.allowedBlankLines": 1, + "evenBetterToml.formatter.columnWidth": 130, + "evenBetterToml.formatter.trailingNewline": true, + "evenBetterToml.formatter.reorderKeys": true, + "evenBetterToml.formatter.reorderArrays": true, } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index c22f6880..705fd116 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,89 +14,73 @@ repository.workspace = true rust-version.workspace = true version.workspace = true - [workspace.package] -authors = [ - "Nautilus Cyberneering , Mick van Dijke ", -] +authors = ["Nautilus Cyberneering , Mick van Dijke "] categories = ["network-programming", "web-programming"] description = "A feature rich BitTorrent tracker." documentation = "https://docs.rs/crate/torrust-tracker/" edition = "2021" homepage = "https://torrust.com/" -keywords = ["bittorrent", "tracker", "file-sharing", "peer-to-peer", "torrent"] +keywords = ["bittorrent", "file-sharing", "peer-to-peer", "torrent", "tracker"] license-file = "COPYRIGHT" publish = true repository = "https://github.com/torrust/torrust-tracker" rust-version = "1.72" version = "3.0.0-alpha.6" - [dependencies] -tokio = { version = "1.29", features = [ - "rt-multi-thread", - "net", - "sync", - "macros", - "signal", -] } -serde = { version = "1.0", features = ["derive"] } -serde_bencode = "^0.2" -serde_json = "1.0" -serde_with = "3.2" -percent-encoding = "2.2" +aquatic_udp_protocol = "0.8" +async-trait = "0.1" +axum = "0.6" +axum-client-ip = "0.4" +axum-server = { version = "0.5", features = ["tls-rustls"] } binascii = "0.1" -lazy_static = "1.4" -openssl = { version = "0.10", features = ["vendored"] } +chrono = { version = "0.4", default-features = false, features = ["clock"] } config = "0.13" -log = { version = "0.4", features = ["release_max_level_info"] } +derive_more = "0.99" fern = "0.6" -chrono = { version = "0.4", default-features = false, features = ["clock"] } +futures = "0.3" +hyper = "0.14" +lazy_static = "1.4" +log = { version = "0.4", features = ["release_max_level_info"] } +multimap = "0.9" +openssl = { version = "0.10", features = ["vendored"] } +percent-encoding = "2.2" r2d2 = "0.8" r2d2_mysql = "24.0" r2d2_sqlite = { version = "0.22", features = ["bundled"] } rand = "0.8" -derive_more = "0.99" +serde = { version = "1.0", features = ["derive"] } +serde_bencode = "^0.2" +serde_json = "1.0" +serde_with = "3.2" thiserror = "1.0" -futures = "0.3" -async-trait = "0.1" -aquatic_udp_protocol = "0.8" -uuid = { version = "1", features = ["v4"] } -axum = "0.6" -axum-server = { version = "0.5", features = ["tls-rustls"] } -axum-client-ip = "0.4" -tower-http = { version = "0.4", features = ["compression-full"] } -torrust-tracker-contrib-bencode = { version = "3.0.0-alpha.6", path = "contrib/bencode" } -torrust-tracker-primitives = { version = "3.0.0-alpha.6", path = "packages/primitives" } +tokio = { version = "1.29", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] } torrust-tracker-configuration = { version = "3.0.0-alpha.6", path = "packages/configuration" } +torrust-tracker-contrib-bencode = { version = "3.0.0-alpha.6", path = "contrib/bencode" } torrust-tracker-located-error = { version = "3.0.0-alpha.6", path = "packages/located-error" } -multimap = "0.9" -hyper = "0.14" +torrust-tracker-primitives = { version = "3.0.0-alpha.6", path = "packages/primitives" } +tower-http = { version = "0.4", features = ["compression-full"] } +uuid = { version = "1", features = ["v4"] } [dev-dependencies] +local-ip-address = "0.5" mockall = "0.11" reqwest = { version = "0.11.18", features = ["json"] } -serde_urlencoded = "0.7" -serde_repr = "0.1" serde_bytes = "0.11" -local-ip-address = "0.5" +serde_repr = "0.1" +serde_urlencoded = "0.7" torrust-tracker-test-helpers = { version = "3.0.0-alpha.6", path = "packages/test-helpers" } [workspace] -members = [ - "contrib/bencode", - "packages/configuration", - "packages/primitives", - "packages/test-helpers", - "packages/located-error", -] +members = ["contrib/bencode", "packages/configuration", "packages/located-error", "packages/primitives", "packages/test-helpers"] [profile.dev] debug = 1 -opt-level = 1 lto = "thin" +opt-level = 1 [profile.release] debug = 1 -opt-level = 3 lto = "fat" +opt-level = 3 diff --git a/contrib/bencode/Cargo.toml b/contrib/bencode/Cargo.toml index 2aed1840..3918aa6b 100644 --- a/contrib/bencode/Cargo.toml +++ b/contrib/bencode/Cargo.toml @@ -1,14 +1,12 @@ [package] -name = "torrust-tracker-contrib-bencode" description = "(contrib) Efficient decoding and encoding for bencode." -keywords = ["library", "contrib", "bencode"] +keywords = ["bencode", "contrib", "library"] +name = "torrust-tracker-contrib-bencode" readme = "README.md" -authors = [ - "Nautilus Cyberneering , Andrew ", -] -repository = "https://github.com/torrust/bittorrent-infrastructure-project" +authors = ["Nautilus Cyberneering , Andrew "] license = "Apache-2.0" +repository = "https://github.com/torrust/bittorrent-infrastructure-project" documentation.workspace = true edition.workspace = true @@ -17,7 +15,6 @@ publish.workspace = true rust-version.workspace = true version.workspace = true - [dependencies] error-chain = "0.12" @@ -29,5 +26,5 @@ name = "test" path = "test/mod.rs" [[bench]] -name = "bencode_benchmark" harness = false +name = "bencode_benchmark" diff --git a/packages/configuration/Cargo.toml b/packages/configuration/Cargo.toml index 2592268e..e5b9e31c 100644 --- a/packages/configuration/Cargo.toml +++ b/packages/configuration/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "torrust-tracker-configuration" description = "A library to provide configuration to the Torrust Tracker." -keywords = ["library", "config", "settings"] +keywords = ["config", "library", "settings"] +name = "torrust-tracker-configuration" readme = "README.md" authors.workspace = true @@ -14,16 +14,15 @@ repository.workspace = true rust-version.workspace = true version.workspace = true - [dependencies] -serde = { version = "1.0", features = ["derive"] } -serde_with = "3.2" config = "0.13" -toml = "0.8" log = { version = "0.4", features = ["release_max_level_info"] } +serde = { version = "1.0", features = ["derive"] } +serde_with = "3.2" thiserror = "1.0" -torrust-tracker-primitives = { version = "3.0.0-alpha.6", path = "../primitives" } +toml = "0.8" torrust-tracker-located-error = { version = "3.0.0-alpha.6", path = "../located-error" } +torrust-tracker-primitives = { version = "3.0.0-alpha.6", path = "../primitives" } [dev-dependencies] uuid = { version = "1", features = ["v4"] } diff --git a/packages/located-error/Cargo.toml b/packages/located-error/Cargo.toml index ea0b1639..b4c813df 100644 --- a/packages/located-error/Cargo.toml +++ b/packages/located-error/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "torrust-tracker-located-error" description = "A library to provide error decorator with the location and the source of the original error." -keywords = ["library", "helper", "errors"] +keywords = ["errors", "helper", "library"] +name = "torrust-tracker-located-error" readme = "README.md" authors.workspace = true @@ -14,7 +14,6 @@ repository.workspace = true rust-version.workspace = true version.workspace = true - [dependencies] log = { version = "0.4", features = ["release_max_level_info"] } diff --git a/packages/primitives/Cargo.toml b/packages/primitives/Cargo.toml index 9eb092e1..ce6c20ff 100644 --- a/packages/primitives/Cargo.toml +++ b/packages/primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "torrust-tracker-primitives" description = "A library with the primitive types shared by the Torrust tracker packages." -keywords = ["library", "api", "primitives"] +keywords = ["api", "library", "primitives"] +name = "torrust-tracker-primitives" readme = "README.md" authors.workspace = true @@ -14,7 +14,6 @@ repository.workspace = true rust-version.workspace = true version.workspace = true - [dependencies] -serde = { version = "1.0", features = ["derive"] } derive_more = "0.99" +serde = { version = "1.0", features = ["derive"] } diff --git a/packages/test-helpers/Cargo.toml b/packages/test-helpers/Cargo.toml index bec9bb21..c01abed2 100644 --- a/packages/test-helpers/Cargo.toml +++ b/packages/test-helpers/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "torrust-tracker-test-helpers" description = "A library providing helpers for testing the Torrust tracker." -keywords = ["library", "helper", "testing"] +keywords = ["helper", "library", "testing"] +name = "torrust-tracker-test-helpers" readme = "README.md" authors.workspace = true diff --git a/rustfmt.toml b/rustfmt.toml index abbed5ed..76046e6f 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,3 @@ -max_width = 130 -imports_granularity = "Module" group_imports = "StdExternalCrate" +imports_granularity = "Module" +max_width = 130 diff --git a/share/default/config/tracker.container.mysql.toml b/share/default/config/tracker.container.mysql.toml index 60da25db..fb9cbf78 100644 --- a/share/default/config/tracker.container.mysql.toml +++ b/share/default/config/tracker.container.mysql.toml @@ -1,36 +1,35 @@ -log_level = "info" -mode = "public" +announce_interval = 120 db_driver = "MySQL" db_path = "mysql://db_user:db_user_secret_password@mysql:3306/torrust_tracker" -announce_interval = 120 +external_ip = "0.0.0.0" +inactive_peer_cleanup_interval = 600 +log_level = "info" +max_peer_timeout = 900 min_announce_interval = 120 +mode = "public" on_reverse_proxy = false -external_ip = "0.0.0.0" -tracker_usage_statistics = true persistent_torrent_completed_stat = false -max_peer_timeout = 900 -inactive_peer_cleanup_interval = 600 remove_peerless_torrents = true +tracker_usage_statistics = true [[udp_trackers]] -enabled = false bind_address = "0.0.0.0:6969" +enabled = false [[http_trackers]] -enabled = false bind_address = "0.0.0.0:7070" -ssl_enabled = false +enabled = false ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt" +ssl_enabled = false ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key" [http_api] -enabled = true bind_address = "0.0.0.0:1212" -ssl_enabled = false +enabled = true ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt" +ssl_enabled = false ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key" - # Please override the admin token setting the # `TORRUST_TRACKER_API_ADMIN_TOKEN` # environmental variable! diff --git a/share/default/config/tracker.container.sqlite3.toml b/share/default/config/tracker.container.sqlite3.toml index 64cf7551..54cfd402 100644 --- a/share/default/config/tracker.container.sqlite3.toml +++ b/share/default/config/tracker.container.sqlite3.toml @@ -1,36 +1,35 @@ -log_level = "info" -mode = "public" +announce_interval = 120 db_driver = "Sqlite3" db_path = "/var/lib/torrust/tracker/database/sqlite3.db" -announce_interval = 120 +external_ip = "0.0.0.0" +inactive_peer_cleanup_interval = 600 +log_level = "info" +max_peer_timeout = 900 min_announce_interval = 120 +mode = "public" on_reverse_proxy = false -external_ip = "0.0.0.0" -tracker_usage_statistics = true persistent_torrent_completed_stat = false -max_peer_timeout = 900 -inactive_peer_cleanup_interval = 600 remove_peerless_torrents = true +tracker_usage_statistics = true [[udp_trackers]] -enabled = false bind_address = "0.0.0.0:6969" +enabled = false [[http_trackers]] -enabled = false bind_address = "0.0.0.0:7070" -ssl_enabled = false +enabled = false ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt" +ssl_enabled = false ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key" [http_api] -enabled = true bind_address = "0.0.0.0:1212" -ssl_enabled = false +enabled = true ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt" +ssl_enabled = false ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key" - # Please override the admin token setting the # `TORRUST_TRACKER_API_ADMIN_TOKEN` # environmental variable! diff --git a/share/default/config/tracker.development.sqlite3.toml b/share/default/config/tracker.development.sqlite3.toml index be187746..20f95ac5 100644 --- a/share/default/config/tracker.development.sqlite3.toml +++ b/share/default/config/tracker.development.sqlite3.toml @@ -1,33 +1,33 @@ -log_level = "info" -mode = "public" +announce_interval = 120 db_driver = "Sqlite3" db_path = "./storage/tracker/lib/database/sqlite3.db" -announce_interval = 120 +external_ip = "0.0.0.0" +inactive_peer_cleanup_interval = 600 +log_level = "info" +max_peer_timeout = 900 min_announce_interval = 120 +mode = "public" on_reverse_proxy = false -external_ip = "0.0.0.0" -tracker_usage_statistics = true persistent_torrent_completed_stat = false -max_peer_timeout = 900 -inactive_peer_cleanup_interval = 600 remove_peerless_torrents = true +tracker_usage_statistics = true [[udp_trackers]] -enabled = false bind_address = "0.0.0.0:6969" +enabled = false [[http_trackers]] -enabled = false bind_address = "0.0.0.0:7070" -ssl_enabled = false +enabled = false ssl_cert_path = "" +ssl_enabled = false ssl_key_path = "" [http_api] -enabled = true bind_address = "127.0.0.1:1212" -ssl_enabled = false +enabled = true ssl_cert_path = "" +ssl_enabled = false ssl_key_path = "" [http_api.access_tokens]