Skip to content

Commit 297658f

Browse files
authored
Merge pull request #11 from PabloVenino/main
fix: Adjusting the ReverseDNS bug
2 parents 73a545c + 7a7f6b6 commit 297658f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bet-blocker/Business/BetBusiness.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System.Collections.Concurrent;
22
using bet_blocker.Business.Interfaces;
33
using Infrastructure.Services.Interfaces;
4-
using static bet_blocker.DTOs.ResponseHostDto;
54
using System.Text.Json;
5+
using static bet_blocker.DTOs.ResponseHostDto;
6+
using System.Net;
7+
using bet_blocker.DTOs;
68

79
namespace bet_blocker.Business
810
{
@@ -120,20 +122,21 @@ private static async Task<ResponseHostsDTO> ResolveDomainInfo(string domain)
120122
{
121123
var hostEntry = await System.Net.Dns.GetHostEntryAsync(domain);
122124
var ipAddress = hostEntry.AddressList.FirstOrDefault()?.ToString();
125+
IPAddress ip = IPAddress.Parse(ipAddress ?? "");
123126

124127
responseHost.Ips = new Ips
125128
{
126129
Ip = ipAddress,
127130
ResolvedAt = DateTime.UtcNow
128131
};
129132

130-
responseHost.DNS = new Dns
133+
responseHost.DNS = new ResponseHostDto.Dns
131134
{
132135
Type = hostEntry.AddressList.FirstOrDefault()?.AddressFamily.ToString(),
133136
Name = hostEntry.HostName,
134137
Host = domain,
135138
CanonicalName = hostEntry.HostName,
136-
ReverseDns = ipAddress,
139+
ReverseDns = System.Net.Dns.GetHostEntryAsync(ip).Result.HostName,
137140
TTl = "3600",
138141
ResolvedAt = DateTime.UtcNow
139142
};

0 commit comments

Comments
 (0)