Skip to main content

pkarr/
lib.rs

1#![doc = include_str!("../README.md")]
2//! ## Feature flags
3#![doc = document_features::document_features!()]
4//!
5
6#![deny(missing_docs)]
7#![deny(rustdoc::broken_intra_doc_links)]
8#![cfg_attr(not(test), deny(clippy::unwrap_used))]
9
10// Modules
11#[cfg(client)]
12mod client;
13#[cfg(client)]
14pub mod extra;
15#[cfg(feature = "keys")]
16mod keys;
17#[cfg(feature = "signed_packet")]
18mod signed_packet;
19
20/// Default minimum TTL: 5 minutes.
21pub const DEFAULT_MINIMUM_TTL: u32 = 300;
22/// Default maximum TTL: 24 hours.
23pub const DEFAULT_MAXIMUM_TTL: u32 = 24 * 60 * 60;
24/// Default [Relays](https://github.com/pubky/pkarr/blob/main/design/relays.md).
25pub const DEFAULT_RELAYS: [&str; 2] = ["https://pkarr.pubky.app", "https://pkarr.pubky.org"];
26#[cfg(feature = "__client")]
27/// Default cache size: 1000
28pub const DEFAULT_CACHE_SIZE: usize = 1000;
29
30// Exports
31#[cfg(all(client, not(wasm_browser)))]
32pub use client::blocking::ClientBlocking;
33#[cfg(client)]
34pub use client::cache::{Cache, CacheKey, InMemoryCache};
35#[cfg(client)]
36pub use client::{builder::ClientBuilder, Client};
37#[cfg(feature = "keys")]
38pub use keys::{Keypair, PublicKey};
39#[cfg(feature = "signed_packet")]
40pub use signed_packet::{SignedPacket, SignedPacketBuilder};
41
42// Rexports
43#[cfg(dht)]
44pub use mainline;
45#[cfg(feature = "signed_packet")]
46pub use ntimestamp::Timestamp;
47#[cfg(feature = "signed_packet")]
48pub use simple_dns as dns;
49
50pub mod errors {
51    //! Exported errors
52
53    #[cfg(feature = "keys")]
54    pub use super::keys::PublicKeyError;
55
56    #[cfg(feature = "signed_packet")]
57    pub use super::signed_packet::{SignedPacketBuildError, SignedPacketVerifyError};
58
59    #[cfg(client)]
60    pub use super::client::{BuildError, ConcurrencyError, PublishError, QueryError};
61}