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