@@ -127,7 +127,8 @@ pub(crate) const HRN_RESOLUTION_TIMEOUT_SECS: u64 = 5;
127127/// | `probing_liquidity_limit_multiplier` | 3 |
128128/// | `log_level` | Debug |
129129/// | `anchor_channels_config` | Some(..) |
130- /// | `route_parameters` | None |
130+ /// | `route_parameters` | None |
131+ /// | `hrn_config` | Some(..) |
131132///
132133/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
133134/// respective default values.
@@ -192,6 +193,18 @@ pub struct Config {
192193 /// **Note:** If unset, default parameters will be used, and you will be able to override the
193194 /// parameters on a per-payment basis in the corresponding method calls.
194195 pub route_parameters : Option < RouteParametersConfig > ,
196+ /// Configuration options for Human-Readable Names ([BIP 353]).
197+ ///
198+ /// By default, this uses the `Dns` variant with the following settings:
199+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
200+ /// * **Resolution Service**: Enabled (`true`)
201+ ///
202+ /// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
203+ /// configuration. For resolution to function correctly, the local node must
204+ /// also be configured as an **announceable node** within the network.
205+ ///
206+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
207+ pub hrn_config : Option < HumanReadableNamesConfig > ,
195208}
196209
197210impl Default for Config {
@@ -206,6 +219,57 @@ impl Default for Config {
206219 anchor_channels_config : Some ( AnchorChannelsConfig :: default ( ) ) ,
207220 route_parameters : None ,
208221 node_alias : None ,
222+ hrn_config : Some ( HumanReadableNamesConfig :: default ( ) ) ,
223+ }
224+ }
225+ }
226+
227+ /// Configuration options for how our node resolves Human-Readable Names (HRNs) when acting as a client.
228+ #[ derive( Debug , Clone ) ]
229+ pub enum HRNResolverConfig {
230+ /// Use bLIP-32 to ask other nodes to resolve names for us.
231+ Blip32 ,
232+ /// Resolve names locally using a specific DNS server.
233+ Dns {
234+ /// The IP and port of the DNS server.
235+ /// **Default:** `8.8.8.8:53` (Google Public DNS)
236+ dns_server_address : String ,
237+ /// If set to true, this allows others to use our node for HRN resolutions ([bLIP-32]).
238+ ///
239+ /// **Note:** This feature requires the underlying node to be announceable.
240+ ///
241+ /// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
242+ enable_hrn_resolution_service : bool ,
243+ } ,
244+ }
245+
246+ /// Configuration options for Human-Readable Names ([BIP 353]).
247+ /// By default, this uses the `Dns` variant with the following settings:
248+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
249+ /// * **Resolution Service**: Enabled (`true`)
250+ ///
251+ /// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
252+ /// configuration. For resolution to function correctly, the local node must
253+ /// also be configured as an **announceable node** within the network.
254+ ///
255+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
256+ #[ derive( Debug , Clone ) ]
257+ pub struct HumanReadableNamesConfig {
258+ /// This sets how our node resolves names when we want to send a payment.
259+ ///
260+ /// By default, this uses the `Dns` variant with the following settings:
261+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
262+ /// * **Resolution Service**: Enabled (`true`)
263+ pub resolution_config : HRNResolverConfig ,
264+ }
265+
266+ impl Default for HumanReadableNamesConfig {
267+ fn default ( ) -> Self {
268+ HumanReadableNamesConfig {
269+ resolution_config : HRNResolverConfig :: Dns {
270+ dns_server_address : "8.8.8.8:53" . to_string ( ) ,
271+ enable_hrn_resolution_service : true ,
272+ } ,
209273 }
210274 }
211275}
0 commit comments