Files
heartwood/crates/radicle-node/src/lib.rs
T
Lorenz Leutgeb 22b2871f64 radicle: Add Version to User Agent
The main motivation behind this change is to get just a little
telemetry information from nodes on the network, namely the version
of Radicle they are running.

This is achieved by rewriting `impl Default for UserAgent` which now
uses the version information provided by the build script also used
in other crates.

Also, a new configuration option `node.userAgent` is added, which
allows users to override the user agent if they so please, or set
the value `null`, which will in turn send the user agent
`/radicle/`, which is not really helpful, and the default prior to
this commit.

Creations of `UserAgent` in the whole workspace is cleaned up. In
order to do that `UserAgent::test` is introduced.
2026-04-02 16:26:46 +01:00

49 lines
1.4 KiB
Rust

// N.b. Rust 1.85 introduced some annoying clippy warnings about using `b""`
// syntax in place of `b''`, but in our cases they were u8 and not [u8] so the
// suggestions did not make sense.
#![allow(clippy::byte_char_slices)]
pub mod fingerprint;
pub mod reactor;
pub mod runtime;
mod control;
pub(crate) use radicle_protocol::service;
mod wire;
mod worker;
#[cfg(any(test, feature = "test"))]
pub mod test;
#[cfg(test)]
pub mod tests;
extern crate radicle_localtime as localtime;
use radicle::version::Version;
pub use localtime::{LocalDuration, LocalTime};
pub use radicle::node::Link;
pub use radicle::node::PROTOCOL_VERSION;
pub use radicle::prelude::Timestamp;
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
pub use runtime::Runtime;
/// Node version.
pub const VERSION: Version = Version {
name: env!("CARGO_PKG_NAME"),
commit: env!("GIT_HEAD"),
version: env!("RADICLE_VERSION"),
timestamp: env!("SOURCE_DATE_EPOCH"),
};
pub mod prelude {
pub use crate::crypto::{PublicKey, Signature};
pub use crate::identity::{Did, RepoId};
pub use crate::node::{Address, Event, NodeId, config::Network};
pub use crate::service::filter::Filter;
pub use crate::service::{DisconnectReason, Message};
pub use crate::storage::WriteStorage;
pub use crate::storage::refs::Refs;
pub use crate::{LocalDuration, LocalTime, Timestamp};
}