Skip to content

Commit

Permalink
Added DNS Service to Rutanio.Node (#175)
Browse files Browse the repository at this point in the history
* Added DNS Service to Rutanio.Node

* Re-order left menu

* Remove custom agent
  • Loading branch information
turcol authored Jul 2, 2020
1 parent 57acad0 commit ee79a8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/Networks/Rutanio/Rutanio.Node/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Blockcore.Features.BlockStore;
using Blockcore.Features.ColdStaking;
using Blockcore.Features.Consensus;
using Blockcore.Features.Dns;
using Blockcore.Features.Diagnostic;
using Blockcore.Features.MemoryPool;
using Blockcore.Features.Miner;
Expand All @@ -22,18 +23,21 @@ public static async Task Main(string[] args)
{
try
{
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args, agent: "Blockcore-RUTA");
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args);

IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
.UseNodeSettings(nodeSettings)
.UseBlockStore()
.UseMempool()
.UseNodeHost()
.AddRPC()
.UseDiagnosticFeature()
.UsePosConsensus()
.UseMempool()
.AddPowPosMining()
.UseColdStakingWallet();
.UseDiagnosticFeature()
.UseNodeHost()
.AddRPC();

// Build the Dns full node if enabled
UseDnsFullNode(nodeBuilder, nodeSettings);

IFullNode node = nodeBuilder.Build();

Expand All @@ -45,5 +49,17 @@ public static async Task Main(string[] args)
Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex);
}
}
static void UseDnsFullNode(IFullNodeBuilder nodeBuilder, NodeSettings nodeSettings)
{
if (nodeSettings.ConfigReader.GetOrDefault("dnsfullnode", false, nodeSettings.Logger))
{
var dnsSettings = new DnsSettings(nodeSettings);

if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox))
throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line.");

nodeBuilder.UseDns();
}
}
}
}
1 change: 1 addition & 0 deletions src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\External\NBitcoin\NBitcoin.csproj" />
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Dns\Blockcore.Features.Dns.csproj" />
<ProjectReference Include="..\..\..\Features\Blockcore.Features.NodeHost\Blockcore.Features.NodeHost.csproj" />
<ProjectReference Include="..\..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
<ProjectReference Include="..\..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />
Expand Down

0 comments on commit ee79a8f

Please sign in to comment.