Skip to content

Commit a0acb1a

Browse files
authored
Added DNS Service to Blockcore.Node (#176)
1 parent 7d49a73 commit a0acb1a

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/Node/Blockcore.Node/Blockcore.Node.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<ProjectReference Include="..\..\Networks\Stratis\Blockcore.Networks.Stratis\Blockcore.Networks.Stratis.csproj" />
1919
<ProjectReference Include="..\..\Networks\x42\x42\x42.Networks.csproj" />
2020
<ProjectReference Include="..\..\Networks\Xds\Blockcore.Networks.Xds\Blockcore.Networks.Xds.csproj" />
21+
<ProjectReference Include="..\..\Features\Blockcore.Features.Dns\Blockcore.Features.Dns.csproj" />
2122
<ProjectReference Include="..\..\Features\Blockcore.Features.NodeHost\Blockcore.Features.NodeHost.csproj" />
2223
<ProjectReference Include="..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
2324
<ProjectReference Include="..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />

src/Node/Blockcore.Node/NodeBuilder.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Blockcore.Features.RPC;
1010
using Blockcore.Features.Wallet;
1111
using Blockcore.Features.NodeHost;
12+
using Blockcore.Features.Dns;
1213

1314
namespace Blockcore.Node
1415
{
@@ -48,7 +49,21 @@ private static IFullNodeBuilder CreateBaseBuilder(string chain, NodeSettings set
4849
.AddRPC()
4950
.UseDiagnosticFeature();
5051

52+
UseDnsFullNode(nodeBuilder, settings);
53+
5154
return nodeBuilder;
5255
}
56+
static void UseDnsFullNode(IFullNodeBuilder nodeBuilder, NodeSettings nodeSettings)
57+
{
58+
if (nodeSettings.ConfigReader.GetOrDefault("dnsfullnode", false, nodeSettings.Logger))
59+
{
60+
var dnsSettings = new DnsSettings(nodeSettings);
61+
62+
if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox))
63+
throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line.");
64+
65+
nodeBuilder.UseDns();
66+
}
67+
}
5368
}
5469
}

0 commit comments

Comments
 (0)