diff --git a/Cargo.toml b/Cargo.toml index 5b9e62e..1267aa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,12 @@ members = [ "crates/*", "ncro" ] resolver = "3" [workspace.package] -edition = "2024" -license = "EUPL-1.2" -version = "2.0.0" +description = "Nix Cache Route Optimizer" +edition = "2024" +homepage = "https://github.com/notashelf/ncro" +license = "EUPL-1.2" +repository = "https://github.com/notashelf/ncro" +version = "2.0.0" [workspace.dependencies] # Workspace components diff --git a/config.example.toml b/config.example.toml index c9b3ac4..9f30b3f 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,39 +1,39 @@ [server] -listen = ":8080" -read_timeout = "30s" +listen = ":8080" +read_timeout = "30s" write_timeout = "30s" [[upstreams]] -url = "https://cache.nixos.org" -priority = 10 +priority = 10 public_key = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" +url = "https://cache.nixos.org" # Try without a public key. [[upstreams]] -url = "https://nix-community.cachix.org" priority = 20 +url = "https://nix-community.cachix.org" [cache] -db_path = "/var/lib/ncro/routes.db" -max_entries = 100000 -ttl = "1h" -negative_ttl = "10m" +db_path = "/var/lib/ncro/routes.db" latency_alpha = 0.3 +max_entries = 100000 +negative_ttl = "10m" +ttl = "1h" [discovery] -enabled = false -service_name = "_nix-serve._tcp" -domain = "local" discovery_time = "5s" -priority = 20 +domain = "local" +enabled = false +priority = 20 +service_name = "_nix-serve._tcp" [mesh] -enabled = false -bind_addr = "0.0.0.0:7946" -peers = [] -private_key = "/etc/ncro/node.key" +bind_addr = "0.0.0.0:7946" +enabled = false gossip_interval = "30s" +peers = [ ] +private_key = "/etc/ncro/node.key" [logging] -level = "info" format = "json" +level = "info" diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index a6ea049..6a850d1 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-config" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-config" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] hex.workspace = true diff --git a/crates/db/Cargo.toml b/crates/db/Cargo.toml index 4269d86..7317ab8 100644 --- a/crates/db/Cargo.toml +++ b/crates/db/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-db" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-db" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] chrono = { workspace = true, features = [ "serde" ] } diff --git a/crates/db/src/lib.rs b/crates/db/src/lib.rs index f9a35a5..6bd430d 100644 --- a/crates/db/src/lib.rs +++ b/crates/db/src/lib.rs @@ -32,7 +32,7 @@ pub struct RouteEntry { } impl RouteEntry { - #[must_use] + #[must_use] pub fn is_valid(&self) -> bool { Utc::now() < self.ttl } diff --git a/crates/discovery/Cargo.toml b/crates/discovery/Cargo.toml index fe1d3d3..9eb5f53 100644 --- a/crates/discovery/Cargo.toml +++ b/crates/discovery/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-discovery" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-discovery" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] anyhow.workspace = true diff --git a/crates/health/Cargo.toml b/crates/health/Cargo.toml index ce2bac7..73da1c0 100644 --- a/crates/health/Cargo.toml +++ b/crates/health/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-health" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-health" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] diff --git a/crates/health/src/lib.rs b/crates/health/src/lib.rs index 42f7e8e..cf38748 100644 --- a/crates/health/src/lib.rs +++ b/crates/health/src/lib.rs @@ -16,7 +16,7 @@ pub enum Status { } impl Status { - #[must_use] + #[must_use] pub const fn as_str(self) -> &'static str { match self { Self::Active => "ACTIVE", @@ -66,7 +66,7 @@ struct ProberInner { } impl Prober { - #[must_use] + #[must_use] pub fn new(alpha: f64) -> Self { Self { inner: Arc::new(ProberInner { diff --git a/crates/mesh/Cargo.toml b/crates/mesh/Cargo.toml index 6954e7c..69f2bde 100644 --- a/crates/mesh/Cargo.toml +++ b/crates/mesh/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-mesh" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-mesh" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] chrono.workspace = true diff --git a/crates/mesh/src/lib.rs b/crates/mesh/src/lib.rs index f91c6ca..711d7a4 100644 --- a/crates/mesh/src/lib.rs +++ b/crates/mesh/src/lib.rs @@ -72,11 +72,11 @@ impl Node { }) } - #[must_use] + #[must_use] pub fn id(&self) -> String { hex::encode(&self.public_key()[..8]) } - #[must_use] + #[must_use] pub fn public_key(&self) -> [u8; 32] { self.signing_key.verifying_key().to_bytes() } diff --git a/crates/metrics/Cargo.toml b/crates/metrics/Cargo.toml index e19017e..cc0d019 100644 --- a/crates/metrics/Cargo.toml +++ b/crates/metrics/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-metrics" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-metrics" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] prometheus.workspace = true diff --git a/crates/metrics/src/lib.rs b/crates/metrics/src/lib.rs index 9c68bc9..443d7fd 100644 --- a/crates/metrics/src/lib.rs +++ b/crates/metrics/src/lib.rs @@ -99,7 +99,7 @@ pub fn get() -> &'static Metrics { }) } -#[must_use] +#[must_use] pub fn gather() -> String { let mut buf = Vec::new(); let encoder = TextEncoder::new(); diff --git a/crates/narinfo/Cargo.toml b/crates/narinfo/Cargo.toml index 86d0f90..1c08cb5 100644 --- a/crates/narinfo/Cargo.toml +++ b/crates/narinfo/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-narinfo" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-narinfo" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] base64.workspace = true diff --git a/crates/narinfo/src/lib.rs b/crates/narinfo/src/lib.rs index 0ebe61b..041fec9 100644 --- a/crates/narinfo/src/lib.rs +++ b/crates/narinfo/src/lib.rs @@ -164,7 +164,7 @@ impl NarInfo { Ok(narinfo) } - #[must_use] + #[must_use] pub fn fingerprint(&self) -> String { let refs = self .references diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index c572d7b..1f878bf 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-router" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-router" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] chrono.workspace = true diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index 4496e87..0d95590 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -57,7 +57,7 @@ struct RaceResult { } impl Router { - #[must_use] + #[must_use] pub fn new( db: Db, prober: Prober, diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index b3f987b..94355de 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -1,9 +1,11 @@ [package] -name = "ncro-server" -version.workspace = true -edition.workspace = true -license.workspace = true -publish = false +name = "ncro-server" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] axum = { workspace = true, features = [ "macros" ] } diff --git a/ncro/Cargo.toml b/ncro/Cargo.toml index aa2d61a..0765852 100644 --- a/ncro/Cargo.toml +++ b/ncro/Cargo.toml @@ -1,8 +1,11 @@ [package] -name = "ncro" -version.workspace = true -edition.workspace = true -license.workspace = true +name = "ncro" +version.workspace = true +edition.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] anyhow.workspace = true