radicle_node/
lib.rs

1// N.b. Rust 1.85 introduced some annoying clippy warnings about using `b""`
2// syntax in place of `b''`, but in our cases they were u8 and not [u8] so the
3// suggestions did not make sense.
4#![allow(clippy::byte_char_slices)]
5
6use std::str::FromStr;
7use std::sync::LazyLock;
8
9pub mod control;
10pub mod fingerprint;
11pub mod runtime;
12pub(crate) use radicle_protocol::service;
13#[cfg(any(test, feature = "test"))]
14pub mod test;
15#[cfg(test)]
16pub mod tests;
17pub mod wire;
18pub mod worker;
19
20use radicle::version::Version;
21
22pub use localtime::{LocalDuration, LocalTime};
23pub use radicle::node::Link;
24pub use radicle::node::UserAgent;
25pub use radicle::node::PROTOCOL_VERSION;
26pub use radicle::prelude::Timestamp;
27pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
28pub use runtime::Runtime;
29
30/// Node version.
31pub const VERSION: Version = Version {
32    name: env!("CARGO_PKG_NAME"),
33    commit: env!("GIT_HEAD"),
34    version: env!("RADICLE_VERSION"),
35    timestamp: env!("SOURCE_DATE_EPOCH"),
36};
37
38/// This node's user agent string.
39pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
40    FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
41        .expect("user agent is valid")
42});
43
44pub mod prelude {
45    pub use crate::crypto::{PublicKey, Signature};
46    pub use crate::identity::{Did, RepoId};
47    pub use crate::node::{config::Network, Address, Event, NodeId};
48    pub use crate::service::filter::Filter;
49    pub use crate::service::{DisconnectReason, Message};
50    pub use crate::storage::refs::Refs;
51    pub use crate::storage::WriteStorage;
52    pub use crate::{LocalDuration, LocalTime, Timestamp};
53}