@@ -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,58 @@ 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).
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` allows your node to act
245+ /// as a resolver for the rest of the network. For this to work, your node must
246+ /// be announceable (publicly visible in the network graph) so that other nodes
247+ /// can route resolution requests to you via Onion Messages. This does not affect
248+ /// your node's ability to resolve names for its own outgoing payments.
249+ enable_hrn_resolution_service : bool ,
250+ } ,
251+ }
252+
253+ /// Configuration options for Human-Readable Names ([BIP 353]).
254+ ///
255+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
256+ #[ derive( Debug , Clone ) ]
257+ #[ cfg_attr( feature = "uniffi" , derive( uniffi:: Record ) ) ]
258+ pub struct HumanReadableNamesConfig {
259+ /// This sets how our node resolves names when we want to send a payment.
260+ ///
261+ /// By default, this uses the `Dns` variant with the following settings:
262+ /// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
263+ /// * **Resolution Service**: Enabled (`true`)
264+ pub resolution_config : HRNResolverConfig ,
265+ }
266+
267+ impl Default for HumanReadableNamesConfig {
268+ fn default ( ) -> Self {
269+ HumanReadableNamesConfig {
270+ resolution_config : HRNResolverConfig :: Dns {
271+ dns_server_address : "8.8.8.8:53" . to_string ( ) ,
272+ enable_hrn_resolution_service : true ,
273+ } ,
217274 }
218275 }
219276}
0 commit comments