@@ -128,7 +128,8 @@ pub(crate) const HRN_RESOLUTION_TIMEOUT_SECS: u64 = 5;
128128/// | `probing_liquidity_limit_multiplier` | 3 |
129129/// | `log_level` | Debug |
130130/// | `anchor_channels_config` | Some(..) |
131- /// | `route_parameters` | None |
131+ /// | `route_parameters` | None |
132+ /// | `hrn_config` | Some(..) |
132133///
133134/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
134135/// respective default values.
@@ -193,6 +194,10 @@ pub struct Config {
193194 /// **Note:** If unset, default parameters will be used, and you will be able to override the
194195 /// parameters on a per-payment basis in the corresponding method calls.
195196 pub route_parameters : Option < RouteParametersConfig > ,
197+ /// Configuration options for Human-Readable Names ([BIP 353]).
198+ ///
199+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
200+ pub hrn_config : HumanReadableNamesConfig ,
196201}
197202
198203impl Default for Config {
@@ -207,6 +212,54 @@ impl Default for Config {
207212 anchor_channels_config : Some ( AnchorChannelsConfig :: default ( ) ) ,
208213 route_parameters : None ,
209214 node_alias : None ,
215+ hrn_config : HumanReadableNamesConfig :: default ( ) ,
216+ }
217+ }
218+ }
219+
220+ /// Configuration options for how our node resolves Human-Readable Names (BIP 353) when acting as a client.
221+ ///
222+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
223+ #[ derive( Debug , Clone ) ]
224+ pub enum HRNResolverConfig {
225+ /// Use [bLIP-32] to ask other nodes to resolve names for us.
226+ ///
227+ /// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
228+ Blip32 ,
229+ /// Resolve names locally using a specific DNS server.
230+ Dns {
231+ /// The IP and port of the DNS server.
232+ /// **Default:** `8.8.8.8:53` (Google Public DNS)
233+ dns_server_address : String ,
234+ /// If set to true, this allows others to use our node for HRN resolutions.
235+ ///
236+ /// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
237+ /// configuration. For resolution to function correctly, the local node must
238+ /// also be configured as an **announceable node** within the network.
239+ enable_hrn_resolution_service : bool ,
240+ } ,
241+ }
242+
243+ /// Configuration options for Human-Readable Names ([BIP 353]).
244+ ///
245+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
246+ #[ derive( Debug , Clone ) ]
247+ pub struct HumanReadableNamesConfig {
248+ /// This sets how our node resolves names when we want to send a payment.
249+ ///
250+ /// By default, this uses the `Dns` variant with the following settings:
251+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
252+ /// * **Resolution Service**: Enabled (`true`)
253+ pub resolution_config : HRNResolverConfig ,
254+ }
255+
256+ impl Default for HumanReadableNamesConfig {
257+ fn default ( ) -> Self {
258+ HumanReadableNamesConfig {
259+ resolution_config : HRNResolverConfig :: Dns {
260+ dns_server_address : "8.8.8.8:53" . to_string ( ) ,
261+ enable_hrn_resolution_service : true ,
262+ } ,
210263 }
211264 }
212265}
0 commit comments