Skip to content

Commit 41d0fd6

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 a67d97c commit 41d0fd6

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
@@ -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,56 @@ 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) when acting as a client.
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` is only one part of the
245+
/// configuration. For resolution to function correctly, the local node must
246+
/// also be configured as an **announceable node** within the network.
247+
enable_hrn_resolution_service: bool,
248+
},
249+
}
250+
251+
/// Configuration options for Human-Readable Names ([BIP 353]).
252+
///
253+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
254+
#[derive(Debug, Clone)]
255+
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
256+
pub struct HumanReadableNamesConfig {
257+
/// This sets how our node resolves names when we want to send a payment.
258+
///
259+
/// By default, this uses the `Dns` variant with the following settings:
260+
/// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
261+
/// * **Resolution Service**: Enabled (`true`)
262+
pub resolution_config: HRNResolverConfig,
263+
}
264+
265+
impl Default for HumanReadableNamesConfig {
266+
fn default() -> Self {
267+
HumanReadableNamesConfig {
268+
resolution_config: HRNResolverConfig::Dns {
269+
dns_server_address: "8.8.8.8:53".to_string(),
270+
enable_hrn_resolution_service: true,
271+
},
217272
}
218273
}
219274
}

0 commit comments

Comments
 (0)