Skip to main content

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
6pub mod fingerprint;
7pub mod reactor;
8pub mod runtime;
9
10mod control;
11pub(crate) use radicle_protocol::service;
12mod wire;
13mod worker;
14
15#[cfg(any(test, feature = "test"))]
16pub mod test;
17#[cfg(test)]
18pub mod tests;
19
20extern crate radicle_localtime as localtime;
21
22use std::str::FromStr;
23use std::sync::LazyLock;
24
25use radicle::version::Version;
26
27pub use localtime::{LocalDuration, LocalTime};
28pub use radicle::node::Link;
29pub use radicle::node::UserAgent;
30pub use radicle::node::PROTOCOL_VERSION;
31pub use radicle::prelude::Timestamp;
32pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
33pub use runtime::Runtime;
34
35/// Node version.
36pub const VERSION: Version = Version {
37    name: env!("CARGO_PKG_NAME"),
38    commit: env!("GIT_HEAD"),
39    version: env!("RADICLE_VERSION"),
40    timestamp: env!("SOURCE_DATE_EPOCH"),
41};
42
43/// This node's user agent string.
44pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
45    FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
46        .expect("user agent is valid")
47});
48
49pub mod prelude {
50    pub use crate::crypto::{PublicKey, Signature};
51    pub use crate::identity::{Did, RepoId};
52    pub use crate::node::{config::Network, Address, Event, NodeId};
53    pub use crate::service::filter::Filter;
54    pub use crate::service::{DisconnectReason, Message};
55    pub use crate::storage::refs::Refs;
56    pub use crate::storage::WriteStorage;
57    pub use crate::{LocalDuration, LocalTime, Timestamp};
58}