Skip to content

Commit b699f3e

Browse files
committed
Add configuration options for HRN settings
Introduce new configuration parameters to manage Human-Readable Name (HRN) resolution and DNSSEC validation behavior. These settings allow users to define custom resolution preferences for BOLT12 offer lookups. Moving these parameters into the central configuration struct ensures that node behavior is customizable at runtime and consistent across different network environments. This abstraction is necessary to support diverse DNSSEC requirements without hard-coding resolution logic.
1 parent 64e3154 commit b699f3e

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

bindings/ldk_node.udl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,7 @@ typedef string LSPSDateTime;
416416
typedef string ScriptBuf;
417417

418418
typedef enum Event;
419+
420+
typedef interface HRNResolverConfig;
421+
422+
typedef dictionary HumanReadableNamesConfig;

src/config.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
128128
/// | `anchor_channels_config` | Some(..) |
129129
/// | `route_parameters` | None |
130130
/// | `tor_config` | None |
131+
/// | `hrn_config` | HumanReadableNamesConfig::default() |
131132
///
132133
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
133134
/// respective default values.
@@ -199,6 +200,10 @@ pub struct Config {
199200
///
200201
/// **Note**: If unset, connecting to peer OnionV3 addresses will fail.
201202
pub tor_config: Option<TorConfig>,
203+
/// Configuration options for Human-Readable Names ([BIP 353]).
204+
///
205+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
206+
pub hrn_config: HumanReadableNamesConfig,
202207
}
203208

204209
impl Default for Config {
@@ -214,6 +219,58 @@ impl Default for Config {
214219
tor_config: None,
215220
route_parameters: None,
216221
node_alias: None,
222+
hrn_config: HumanReadableNamesConfig::default(),
223+
}
224+
}
225+
}
226+
227+
/// Configuration options for how our node resolves Human-Readable Names (BIP 353).
228+
///
229+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
230+
#[derive(Debug, Clone)]
231+
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
232+
pub enum HRNResolverConfig {
233+
/// Use [bLIP-32] to ask other nodes to resolve names for us.
234+
///
235+
/// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
236+
Blip32,
237+
/// Resolve names locally using a specific DNS server.
238+
Dns {
239+
/// The IP and port of the DNS server.
240+
/// **Default:** `8.8.8.8:53` (Google Public DNS)
241+
dns_server_address: String,
242+
/// If set to true, this allows others to use our node for HRN resolutions.
243+
///
244+
/// **Note:** Enabling `enable_hrn_resolution_service` allows your node to act
245+
/// as a resolver for the rest of the network. For this to work, your node must
246+
/// be announceable (publicly visible in the network graph) so that other nodes
247+
/// can route resolution requests to you via Onion Messages. This does not affect
248+
/// your node's ability to resolve names for its own outgoing payments.
249+
enable_hrn_resolution_service: bool,
250+
},
251+
}
252+
253+
/// Configuration options for Human-Readable Names ([BIP 353]).
254+
///
255+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
256+
#[derive(Debug, Clone)]
257+
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
258+
pub struct HumanReadableNamesConfig {
259+
/// This sets how our node resolves names when we want to send a payment.
260+
///
261+
/// By default, this uses the `Dns` variant with the following settings:
262+
/// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
263+
/// * **Resolution Service**: Enabled (`true`)
264+
pub resolution_config: HRNResolverConfig,
265+
}
266+
267+
impl Default for HumanReadableNamesConfig {
268+
fn default() -> Self {
269+
HumanReadableNamesConfig {
270+
resolution_config: HRNResolverConfig::Dns {
271+
dns_server_address: "8.8.8.8:53".to_string(),
272+
enable_hrn_resolution_service: true,
273+
},
217274
}
218275
}
219276
}

0 commit comments

Comments
 (0)