Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development v3.1.0 #8

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 67 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "torrust-axum"
version = "3.0.1"
version = "3.1.0"
edition = "2021"
license = "AGPL-3.0"
authors = [
Expand All @@ -15,10 +15,10 @@ codegen-units = 1 # Enable this to optimize filesize
panic = "abort" # Enable this to optimize filesize

[dependencies]
async-trait = "0.1.56"
axum = "0.5.13"
async-trait = "0.1.57"
axum = { version = "0.5.13", features = ["ws"] }
axum-client-ip = "0.2.0"
axum-server = { version = "0.4.0", features = ["tls-rustls"] }
axum-server = { version = "0.4.1", features = ["tls-rustls"] }
binascii = "0.1.4"
bip_bencode = "0.4.4"
byteorder = "1.4.3"
Expand All @@ -32,10 +32,10 @@ log = "0.4.17"
percent-encoding = "2.1.0"
rustls = "0.20.6"
scc = "0.8.3"
serde = { version = "1.0.140", features = ["derive"] }
serde = { version = "1.0.141", features = ["derive"] }
serde_json = "1.0.82"
sqlx = { version = "0.6.0", features = ["mysql", "postgres", "sqlite", "runtime-tokio-rustls"] }
thiserror = "1.0.31"
tokio = { version = "1.20.0", features = ["full"] }
tokio = { version = "1.20.1", features = ["full"] }
toml = "0.5.9"
tower = "0.4.13"
25 changes: 23 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ pub struct HttpTrackersConfig {
pub ssl_cert: String
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ApiTrackersConfig {
pub enabled: bool,
pub bind_address: String,
pub ssl: bool,
pub ssl_key: String,
pub ssl_cert: String
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Configuration {
pub log_level: String,
Expand All @@ -45,6 +54,12 @@ pub struct Configuration {
pub persistency: bool,
pub persistency_interval: Option<u64>,

pub api_key: String,

pub whitelist: bool,
pub whitelist_from_persistency: bool,
pub blacklist: bool,

pub interval: Option<u64>,
pub interval_minimum: Option<u64>,
pub interval_cleanup: Option<u64>,
Expand All @@ -53,7 +68,7 @@ pub struct Configuration {

pub udp_server: Vec<UdpTrackersConfig>,
pub http_server: Vec<HttpTrackersConfig>,
pub api_server: Vec<HttpTrackersConfig>
pub api_server: Vec<ApiTrackersConfig>
}
impl Configuration {
pub fn default() -> Configuration {
Expand All @@ -73,7 +88,7 @@ impl Configuration {
}
);
let api_server = vec!(
HttpTrackersConfig {
ApiTrackersConfig {
enabled: false,
bind_address: String::from("0.0.0.0:8080"),
ssl: false,
Expand All @@ -91,6 +106,12 @@ impl Configuration {
persistency: false,
persistency_interval: Some(60),

api_key: String::from("MyAccessToken"),

whitelist: false,
whitelist_from_persistency: false,
blacklist: false,

interval: Some(1800),
interval_minimum: Some(1800),
interval_cleanup: Some(900),
Expand Down
Loading