1mod dnslink;
4mod errors;
5mod namespaces;
6mod resolver;
7
8pub use dnslink::{dns_link, DNSLink, DnsLinkInit};
9pub use errors::DnsLinkError;
10pub use resolver::{DnsResolver, TxtRecord};
11
12use cid::Cid;
13use libp2p_identity::PeerId;
14
15pub const MAX_RECURSIVE_DEPTH: u32 = 32;
16
17#[derive(Debug, Clone, PartialEq)]
18pub enum DnsLinkResult {
19 IPFS {
20 answer: TxtRecord,
21 namespace: String,
22 cid: Cid,
23 path: String,
24 },
25 IPNS {
26 answer: TxtRecord,
27 namespace: String,
28 peer_id: PeerId,
29 path: String,
30 },
31 Other {
32 answer: TxtRecord,
33 namespace: String,
34 value: String,
35 },
36}
37
38#[derive(Debug, Clone)]
39pub struct ResolveOptions {
40 pub nocache: bool,
41 pub offline: bool,
42 pub max_recursive_depth: Option<u32>,
43}
44
45impl Default for ResolveOptions {
46 fn default() -> Self {
47 Self {
48 nocache: false,
49 offline: false,
50 max_recursive_depth: Some(MAX_RECURSIVE_DEPTH),
51 }
52 }
53}