Skip to content

Commit a807463

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 b0e159a commit a807463

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

bindings/ldk_node.udl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ dictionary RouteParametersConfig {
265265
u8 max_channel_saturation_power_of_half;
266266
};
267267

268+
typedef interface HRNResolverConfig;
269+
270+
typedef dictionary HumanReadableNamesConfig;
271+
268272
[Remote]
269273
dictionary LSPS1OrderStatus {
270274
LSPS1OrderId order_id;

src/config.rs

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
131131
/// | `probing_liquidity_limit_multiplier` | 3 |
132132
/// | `log_level` | Debug |
133133
/// | `anchor_channels_config` | Some(..) |
134-
/// | `route_parameters` | None |
134+
/// | `route_parameters` | None |
135+
/// | `hrn_config` | HumanReadableNamesConfig::default() |
135136
///
136137
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
137138
/// respective default values.
@@ -196,6 +197,10 @@ pub struct Config {
196197
/// **Note:** If unset, default parameters will be used, and you will be able to override the
197198
/// parameters on a per-payment basis in the corresponding method calls.
198199
pub route_parameters: Option<RouteParametersConfig>,
200+
/// Configuration options for Human-Readable Names ([BIP 353]).
201+
///
202+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
203+
pub hrn_config: HumanReadableNamesConfig,
199204
}
200205

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

0 commit comments

Comments
 (0)