@@ -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
201206impl 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