@@ -133,6 +133,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
133133/// | `anchor_channels_config` | Some(..) |
134134/// | `route_parameters` | None |
135135/// | `tor_config` | None |
136+ /// | `hrn_config` | HumanReadableNamesConfig::default() |
136137///
137138/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
138139/// respective default values.
@@ -204,6 +205,10 @@ pub struct Config {
204205 ///
205206 /// **Note**: If unset, connecting to peer OnionV3 addresses will fail.
206207 pub tor_config : Option < TorConfig > ,
208+ /// Configuration options for Human-Readable Names ([BIP 353]).
209+ ///
210+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
211+ pub hrn_config : HumanReadableNamesConfig ,
207212}
208213
209214impl Default for Config {
@@ -219,6 +224,56 @@ impl Default for Config {
219224 tor_config : None ,
220225 route_parameters : None ,
221226 node_alias : None ,
227+ hrn_config : HumanReadableNamesConfig :: default ( ) ,
228+ }
229+ }
230+ }
231+
232+ /// Configuration options for how our node resolves Human-Readable Names (BIP 353) when acting as a client.
233+ ///
234+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
235+ #[ derive( Debug , Clone ) ]
236+ #[ cfg_attr( feature = "uniffi" , derive( uniffi:: Enum ) ) ]
237+ pub enum HRNResolverConfig {
238+ /// Use [bLIP-32] to ask other nodes to resolve names for us.
239+ ///
240+ /// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
241+ Blip32 ,
242+ /// Resolve names locally using a specific DNS server.
243+ Dns {
244+ /// The IP and port of the DNS server.
245+ /// **Default:** `8.8.8.8:53` (Google Public DNS)
246+ dns_server_address : String ,
247+ /// If set to true, this allows others to use our node for HRN resolutions.
248+ ///
249+ /// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
250+ /// configuration. For resolution to function correctly, the local node must
251+ /// also be configured as an **announceable node** within the network.
252+ enable_hrn_resolution_service : bool ,
253+ } ,
254+ }
255+
256+ /// Configuration options for Human-Readable Names ([BIP 353]).
257+ ///
258+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
259+ #[ derive( Debug , Clone ) ]
260+ #[ cfg_attr( feature = "uniffi" , derive( uniffi:: Record ) ) ]
261+ pub struct HumanReadableNamesConfig {
262+ /// This sets how our node resolves names when we want to send a payment.
263+ ///
264+ /// By default, this uses the `Dns` variant with the following settings:
265+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
266+ /// * **Resolution Service**: Enabled (`true`)
267+ pub resolution_config : HRNResolverConfig ,
268+ }
269+
270+ impl Default for HumanReadableNamesConfig {
271+ fn default ( ) -> Self {
272+ HumanReadableNamesConfig {
273+ resolution_config : HRNResolverConfig :: Dns {
274+ dns_server_address : "8.8.8.8:53" . to_string ( ) ,
275+ enable_hrn_resolution_service : true ,
276+ } ,
222277 }
223278 }
224279}
0 commit comments