Skip to content

Commit ee79a8f

Browse files
authored
Added DNS Service to Rutanio.Node (#175)
* Added DNS Service to Rutanio.Node * Re-order left menu * Remove custom agent
1 parent 57acad0 commit ee79a8f

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

src/Networks/Rutanio/Rutanio.Node/Program.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Blockcore.Features.BlockStore;
88
using Blockcore.Features.ColdStaking;
99
using Blockcore.Features.Consensus;
10+
using Blockcore.Features.Dns;
1011
using Blockcore.Features.Diagnostic;
1112
using Blockcore.Features.MemoryPool;
1213
using Blockcore.Features.Miner;
@@ -22,18 +23,21 @@ public static async Task Main(string[] args)
2223
{
2324
try
2425
{
25-
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args, agent: "Blockcore-RUTA");
26+
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args);
2627

2728
IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
2829
.UseNodeSettings(nodeSettings)
2930
.UseBlockStore()
30-
.UseMempool()
31-
.UseNodeHost()
32-
.AddRPC()
33-
.UseDiagnosticFeature()
3431
.UsePosConsensus()
32+
.UseMempool()
3533
.AddPowPosMining()
3634
.UseColdStakingWallet();
35+
.UseDiagnosticFeature()
36+
.UseNodeHost()
37+
.AddRPC();
38+
39+
// Build the Dns full node if enabled
40+
UseDnsFullNode(nodeBuilder, nodeSettings);
3741

3842
IFullNode node = nodeBuilder.Build();
3943

@@ -45,5 +49,17 @@ public static async Task Main(string[] args)
4549
Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex);
4650
}
4751
}
52+
static void UseDnsFullNode(IFullNodeBuilder nodeBuilder, NodeSettings nodeSettings)
53+
{
54+
if (nodeSettings.ConfigReader.GetOrDefault("dnsfullnode", false, nodeSettings.Logger))
55+
{
56+
var dnsSettings = new DnsSettings(nodeSettings);
57+
58+
if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox))
59+
throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line.");
60+
61+
nodeBuilder.UseDns();
62+
}
63+
}
4864
}
4965
}

src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<ItemGroup>
1414
<ProjectReference Include="..\..\..\External\NBitcoin\NBitcoin.csproj" />
15+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Dns\Blockcore.Features.Dns.csproj" />
1516
<ProjectReference Include="..\..\..\Features\Blockcore.Features.NodeHost\Blockcore.Features.NodeHost.csproj" />
1617
<ProjectReference Include="..\..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
1718
<ProjectReference Include="..\..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />

0 commit comments

Comments
 (0)