meta: prepare for publishing

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I02ee54baee048c58a480522ce79159eb6a6a6964
This commit is contained in:
raf 2026-05-11 13:25:19 +03:00
commit 265a30d3c8
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
18 changed files with 102 additions and 78 deletions

View file

@ -3,9 +3,12 @@ members = [ "crates/*", "ncro" ]
resolver = "3" resolver = "3"
[workspace.package] [workspace.package]
edition = "2024" description = "Nix Cache Route Optimizer"
license = "EUPL-1.2" edition = "2024"
version = "2.0.0" homepage = "https://github.com/notashelf/ncro"
license = "EUPL-1.2"
repository = "https://github.com/notashelf/ncro"
version = "2.0.0"
[workspace.dependencies] [workspace.dependencies]
# Workspace components # Workspace components

View file

@ -1,39 +1,39 @@
[server] [server]
listen = ":8080" listen = ":8080"
read_timeout = "30s" read_timeout = "30s"
write_timeout = "30s" write_timeout = "30s"
[[upstreams]] [[upstreams]]
url = "https://cache.nixos.org" priority = 10
priority = 10
public_key = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" public_key = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
url = "https://cache.nixos.org"
# Try without a public key. # Try without a public key.
[[upstreams]] [[upstreams]]
url = "https://nix-community.cachix.org"
priority = 20 priority = 20
url = "https://nix-community.cachix.org"
[cache] [cache]
db_path = "/var/lib/ncro/routes.db" db_path = "/var/lib/ncro/routes.db"
max_entries = 100000
ttl = "1h"
negative_ttl = "10m"
latency_alpha = 0.3 latency_alpha = 0.3
max_entries = 100000
negative_ttl = "10m"
ttl = "1h"
[discovery] [discovery]
enabled = false
service_name = "_nix-serve._tcp"
domain = "local"
discovery_time = "5s" discovery_time = "5s"
priority = 20 domain = "local"
enabled = false
priority = 20
service_name = "_nix-serve._tcp"
[mesh] [mesh]
enabled = false bind_addr = "0.0.0.0:7946"
bind_addr = "0.0.0.0:7946" enabled = false
peers = []
private_key = "/etc/ncro/node.key"
gossip_interval = "30s" gossip_interval = "30s"
peers = [ ]
private_key = "/etc/ncro/node.key"
[logging] [logging]
level = "info"
format = "json" format = "json"
level = "info"

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-config" name = "ncro-config"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
hex.workspace = true hex.workspace = true

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-db" name = "ncro-db"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
chrono = { workspace = true, features = [ "serde" ] } chrono = { workspace = true, features = [ "serde" ] }

View file

@ -32,7 +32,7 @@ pub struct RouteEntry {
} }
impl RouteEntry { impl RouteEntry {
#[must_use] #[must_use]
pub fn is_valid(&self) -> bool { pub fn is_valid(&self) -> bool {
Utc::now() < self.ttl Utc::now() < self.ttl
} }

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-discovery" name = "ncro-discovery"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-health" name = "ncro-health"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]

View file

@ -16,7 +16,7 @@ pub enum Status {
} }
impl Status { impl Status {
#[must_use] #[must_use]
pub const fn as_str(self) -> &'static str { pub const fn as_str(self) -> &'static str {
match self { match self {
Self::Active => "ACTIVE", Self::Active => "ACTIVE",
@ -66,7 +66,7 @@ struct ProberInner {
} }
impl Prober { impl Prober {
#[must_use] #[must_use]
pub fn new(alpha: f64) -> Self { pub fn new(alpha: f64) -> Self {
Self { Self {
inner: Arc::new(ProberInner { inner: Arc::new(ProberInner {

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-mesh" name = "ncro-mesh"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
chrono.workspace = true chrono.workspace = true

View file

@ -72,11 +72,11 @@ impl Node {
}) })
} }
#[must_use] #[must_use]
pub fn id(&self) -> String { pub fn id(&self) -> String {
hex::encode(&self.public_key()[..8]) hex::encode(&self.public_key()[..8])
} }
#[must_use] #[must_use]
pub fn public_key(&self) -> [u8; 32] { pub fn public_key(&self) -> [u8; 32] {
self.signing_key.verifying_key().to_bytes() self.signing_key.verifying_key().to_bytes()
} }

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-metrics" name = "ncro-metrics"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
prometheus.workspace = true prometheus.workspace = true

View file

@ -99,7 +99,7 @@ pub fn get() -> &'static Metrics {
}) })
} }
#[must_use] #[must_use]
pub fn gather() -> String { pub fn gather() -> String {
let mut buf = Vec::new(); let mut buf = Vec::new();
let encoder = TextEncoder::new(); let encoder = TextEncoder::new();

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-narinfo" name = "ncro-narinfo"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
base64.workspace = true base64.workspace = true

View file

@ -164,7 +164,7 @@ impl NarInfo {
Ok(narinfo) Ok(narinfo)
} }
#[must_use] #[must_use]
pub fn fingerprint(&self) -> String { pub fn fingerprint(&self) -> String {
let refs = self let refs = self
.references .references

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-router" name = "ncro-router"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
chrono.workspace = true chrono.workspace = true

View file

@ -57,7 +57,7 @@ struct RaceResult {
} }
impl Router { impl Router {
#[must_use] #[must_use]
pub fn new( pub fn new(
db: Db, db: Db,
prober: Prober, prober: Prober,

View file

@ -1,9 +1,11 @@
[package] [package]
name = "ncro-server" name = "ncro-server"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
publish = false description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
axum = { workspace = true, features = [ "macros" ] } axum = { workspace = true, features = [ "macros" ] }

View file

@ -1,8 +1,11 @@
[package] [package]
name = "ncro" name = "ncro"
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true