Skip to content

Commit edbb5ba

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 804f00f commit edbb5ba

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

bindings/ldk_node.udl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ dictionary RouteParametersConfig {
269269
u8 max_channel_saturation_power_of_half;
270270
};
271271

272+
typedef interface HRNResolverConfig;
273+
274+
typedef dictionary HumanReadableNamesConfig;
275+
272276
[Remote]
273277
dictionary LSPS1OrderStatus {
274278
LSPS1OrderId order_id;

src/config.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
133133
/// | `anchor_channels_config` | Some(..) |
134134
/// | `route_parameters` | None |
135135
/// | `tor_config` | None |
136+
/// | `hrn_config` | HumanReadableNamesConfig::default() |
136137
///
137138
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
138139
/// respective default values.
@@ -204,6 +205,10 @@ pub struct Config {
204205
///
205206
/// **Note**: If unset, connecting to peer OnionV3 addresses will fail.
206207
pub tor_config: Option<TorConfig>,
208+
/// Configuration options for Human-Readable Names ([BIP 353]).
209+
///
210+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
211+
pub hrn_config: HumanReadableNamesConfig,
207212
}
208213

209214
impl Default for Config {
@@ -219,6 +224,56 @@ impl Default for Config {
219224
tor_config: None,
220225
route_parameters: None,
221226
node_alias: None,
227+
hrn_config: HumanReadableNamesConfig::default(),
228+
}
229+
}
230+
}
231+
232+
/// Configuration options for how our node resolves Human-Readable Names (BIP 353) when acting as a client.
233+
///
234+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
235+
#[derive(Debug, Clone)]
236+
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
237+
pub enum HRNResolverConfig {
238+
/// Use [bLIP-32] to ask other nodes to resolve names for us.
239+
///
240+
/// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
241+
Blip32,
242+
/// Resolve names locally using a specific DNS server.
243+
Dns {
244+
/// The IP and port of the DNS server.
245+
/// **Default:** `8.8.8.8:53` (Google Public DNS)
246+
dns_server_address: String,
247+
/// If set to true, this allows others to use our node for HRN resolutions.
248+
///
249+
/// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
250+
/// configuration. For resolution to function correctly, the local node must
251+
/// also be configured as an **announceable node** within the network.
252+
enable_hrn_resolution_service: bool,
253+
},
254+
}
255+
256+
/// Configuration options for Human-Readable Names ([BIP 353]).
257+
///
258+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
259+
#[derive(Debug, Clone)]
260+
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
261+
pub struct HumanReadableNamesConfig {
262+
/// This sets how our node resolves names when we want to send a payment.
263+
///
264+
/// By default, this uses the `Dns` variant with the following settings:
265+
/// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
266+
/// * **Resolution Service**: Enabled (`true`)
267+
pub resolution_config: HRNResolverConfig,
268+
}
269+
270+
impl Default for HumanReadableNamesConfig {
271+
fn default() -> Self {
272+
HumanReadableNamesConfig {
273+
resolution_config: HRNResolverConfig::Dns {
274+
dns_server_address: "8.8.8.8:53".to_string(),
275+
enable_hrn_resolution_service: true,
276+
},
222277
}
223278
}
224279
}

0 commit comments

Comments
 (0)