Skip to content

Commit 21ca526

Browse files
authored
Fixing spelling mistakes and other minor things (#70)
* Fixing spelling mistakes * Adding fallback to the Target of the SRV record in ResolveService extensions.
1 parent 3a1488c commit 21ca526

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+182
-99
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![NuGet](https://img.shields.io/nuget/v/DnsClient?color=brightgreen&label=NuGet%20Stable)](https://www.nuget.org/packages/DnsClient)
66
[![NuGet](https://img.shields.io/nuget/vpre/DnsClient?color=yellow&label=NuGet%20Latest)](https://www.nuget.org/packages/DnsClient)
77

8-
DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups.
8+
DnsClient.NET is a simple yet very powerful and high performance open source library for the .NET Framework to do DNS lookups.
99

1010
## Usage
1111

@@ -68,6 +68,6 @@ dotnet run -s localhost mcnet.com any
6868

6969
## Examples
7070

71-
* More docuemntation and a simple query window on http://dnsclient.michaco.net
71+
* More documentation and a simple query window on http://dnsclient.michaco.net
7272
* The [Samples](https://github.com/MichaCo/DnsClient.NET.Samples) repository (there might be more in the future).
7373
* [MiniDig](https://github.com/MichaCo/DnsClient.NET/tree/dev/samples/MiniDig)

samples/MiniDig/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ MiniDig is multi targeted for now, which means, when you use `dotnet run` you ha
1414
If nothing else is specified, it uses the DNS server configured for your local network adapter.
1515
To specify a different server, use the `-s` switch, for example:
1616

17-
`dotnet run -f netcoreapp2.0 -s 8.8.8.8 google.com` to use the public google name server.
17+
`dotnet run -f netcoreapp2.0 -s 8.8.8.8 google.com` to use the public Google name server.
1818

1919

2020
`dotnet run -f netcoreapp2.0 -s 127.0.0.1#8600` to also specify a custom port.

src/DnsClient/DnsClient.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<VersionPrefix>1.3.1</VersionPrefix>
3+
<VersionPrefix>1.3.2</VersionPrefix>
44
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
55

66
<TargetFrameworks>netstandard1.3;netstandard2.0;netstandard2.1;net45;net471</TargetFrameworks>
77
<DebugType>full</DebugType>
88

99
<Product>DnsClient.NET</Product>
10-
<Description>DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups</Description>
10+
<Description>DnsClient.NET is a simple yet very powerful and high performance open source library for the .NET Framework to do DNS lookups</Description>
1111

1212
<Copyright>Copyright (c) 2020 MichaConrad</Copyright>
1313
<Authors>MichaCo</Authors>

src/DnsClient/DnsDatagramReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public ICollection<ArraySegment<byte>> ReadLabels()
293293

294294
var subReader = new DnsDatagramReader(_data.SubArrayFromOriginal(subIndex));
295295
var newLabels = subReader.ReadLabels();
296-
result.AddRange(newLabels); // add range actually much faster than Concat and equal to or faster than foreach.. (array copy would work maybe)
296+
result.AddRange(newLabels); // add range actually much faster than concat and equal to or faster than for-each.. (array copy would work maybe)
297297
return result;
298298
}
299299

@@ -305,7 +305,7 @@ public ICollection<ArraySegment<byte>> ReadLabels()
305305

306306
var label = _data.SubArray(_index, length);
307307

308-
// maybe store orignial bytes in this instance too?
308+
// maybe store original bytes in this instance too?
309309
result.Add(label);
310310

311311
Advance(length);

src/DnsClient/DnsQueryExtensions.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ private static string ConcatResolveServiceName(string baseDomain, string service
628628
private static ServiceHostEntry[] ResolveServiceProcessResult(IDnsQueryResponse result)
629629
{
630630
var hosts = new List<ServiceHostEntry>();
631-
if (result.HasError)
631+
if (result == null || result.HasError)
632632
{
633633
return hosts.ToArray();
634634
}
@@ -643,7 +643,8 @@ private static ServiceHostEntry[] ResolveServiceProcessResult(IDnsQueryResponse
643643
var hostName = result.Additionals
644644
.OfType<CNameRecord>()
645645
.Where(p => p.DomainName.Equals(entry.Target))
646-
.Select(p => p.CanonicalName).FirstOrDefault();
646+
.Select(p => p.CanonicalName).FirstOrDefault()
647+
?? entry.Target;
647648

648649
hosts.Add(new ServiceHostEntry()
649650
{
@@ -674,7 +675,7 @@ public class ServiceHostEntry : IPHostEntry
674675
public int Port { get; set; }
675676

676677
/// <summary>
677-
/// Gets or sets priortiy of the original <see cref="ResourceRecordType.SRV"/> record.
678+
/// Gets or sets priority of the original <see cref="ResourceRecordType.SRV"/> record.
678679
/// Might be zero if not provided.
679680
/// </summary>
680681
/// <value>

src/DnsClient/DnsQueryOptions.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public TimeSpan Timeout
167167
}
168168

169169
/// <summary>
170-
/// Gets or sets a flag indicating whether Tcp should be used in case a Udp response is truncated.
170+
/// Gets or sets a flag indicating whether TCP should be used in case a UDP response is truncated.
171171
/// Default is <c>True</c>.
172172
/// <para>
173173
/// If <c>False</c>, truncated results will potentially yield no or incomplete answers.
@@ -176,10 +176,10 @@ public TimeSpan Timeout
176176
public bool UseTcpFallback { get; set; } = true;
177177

178178
/// <summary>
179-
/// Gets or sets a flag indicating whether Udp should not be used at all.
179+
/// Gets or sets a flag indicating whether UDP should not be used at all.
180180
/// Default is <c>False</c>.
181181
/// <para>
182-
/// Enable this only if Udp cannot be used because of your firewall rules for example.
182+
/// Enable this only if UDP cannot be used because of your firewall rules for example.
183183
/// Also, zone transfers (see <see cref="QueryType.AXFR"/>) must use TCP only.
184184
/// </para>
185185
/// </summary>
@@ -378,11 +378,11 @@ public LookupClientOptions(params IPAddress[] nameServers)
378378
/// TTL of the record is lower than this minimum value.
379379
/// Default is <c>Null</c>.
380380
/// <para>
381-
/// This is useful in case the server retruns records with zero TTL.
381+
/// This is useful in case the server returns records with zero TTL.
382382
/// </para>
383383
/// </summary>
384384
/// <remarks>
385-
/// This setting gets igonred in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>,
385+
/// This setting gets ignored in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>,
386386
/// or the value is set to <c>Null</c> or <see cref="TimeSpan.Zero"/>.
387387
/// The maximum value is 24 days or <see cref="Timeout.Infinite"/> (choose a wise setting).
388388
/// </remarks>
@@ -414,7 +414,7 @@ public TimeSpan? MinimumCacheTimeout
414414
/// Default is <c>Null</c>.
415415
/// </summary>
416416
/// <remarks>
417-
/// This setting gets igonred in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>,
417+
/// This setting gets ignored in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>,
418418
/// or the value is set to <c>Null</c>, <see cref="Timeout.Infinite"/> or <see cref="TimeSpan.Zero"/>.
419419
/// The maximum value is 24 days (which shouldn't be used).
420420
/// </remarks>
@@ -575,7 +575,7 @@ public class DnsQuerySettings : IEquatable<DnsQuerySettings>
575575
public TimeSpan Timeout { get; }
576576

577577
/// <summary>
578-
/// Gets a flag indicating whether Tcp should be used in case a Udp response is truncated.
578+
/// Gets a flag indicating whether TCP should be used in case a UDP response is truncated.
579579
/// Default is <c>True</c>.
580580
/// <para>
581581
/// If <c>False</c>, truncated results will potentially yield no or incomplete answers.
@@ -584,10 +584,10 @@ public class DnsQuerySettings : IEquatable<DnsQuerySettings>
584584
public bool UseTcpFallback { get; }
585585

586586
/// <summary>
587-
/// Gets a flag indicating whether Udp should not be used at all.
587+
/// Gets a flag indicating whether UDP should not be used at all.
588588
/// Default is <c>False</c>.
589589
/// <para>
590-
/// Enable this only if Udp cannot be used because of your firewall rules for example.
590+
/// Enable this only if UDP cannot be used because of your firewall rules for example.
591591
/// Also, zone transfers (see <see cref="QueryType.AXFR"/>) must use TCP only.
592592
/// </para>
593593
/// </summary>
@@ -797,11 +797,11 @@ internal LookupClientSettings(LookupClientOptions options, IReadOnlyCollection<N
797797
/// TTL of the record is lower than this minimum value.
798798
/// Default is <c>Null</c>.
799799
/// <para>
800-
/// This is useful in cases where the server retruns records with zero TTL.
800+
/// This is useful in cases where the server returns records with zero TTL.
801801
/// </para>
802802
/// </summary>
803803
/// <remarks>
804-
/// This setting gets igonred in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>.
804+
/// This setting gets ignored in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>.
805805
/// The maximum value is 24 days or <see cref="Timeout.Infinite"/>.
806806
/// </remarks>
807807
public TimeSpan? MinimumCacheTimeout { get; }
@@ -812,7 +812,7 @@ internal LookupClientSettings(LookupClientOptions options, IReadOnlyCollection<N
812812
/// Default is <c>Null</c>.
813813
/// </summary>
814814
/// <remarks>
815-
/// This setting gets igonred in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>.
815+
/// This setting gets ignored in case <see cref="DnsQueryOptions.UseCache"/> is set to <c>False</c>.
816816
/// The maximum value is 24 days.
817817
/// Setting it to <see cref="Timeout.Infinite"/> would be equal to not providing a value.
818818
/// </remarks>

src/DnsClient/DnsQueryResponse.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class DnsQueryResponse : IDnsQueryResponse
5555
public IReadOnlyList<DnsResourceRecord> Additionals { get; }
5656

5757
/// <summary>
58-
/// Gets a list of all answers, addtional and authority records.
58+
/// Gets a list of all answers, additional and authority records.
5959
/// </summary>
6060
public IEnumerable<DnsResourceRecord> AllRecords
6161
{
@@ -84,13 +84,13 @@ public IEnumerable<DnsResourceRecord> AllRecords
8484
public IReadOnlyList<DnsResourceRecord> Authorities { get; }
8585

8686
/// <summary>
87-
/// Returns a string value representing the error response code in case an error occured,
87+
/// Returns a string value representing the error response code in case an error occurred,
8888
/// otherwise '<see cref="DnsResponseCode.NoError"/>'.
8989
/// </summary>
9090
public string ErrorMessage => DnsResponseCodeText.GetErrorText((DnsResponseCode)Header.ResponseCode);
9191

9292
/// <summary>
93-
/// A flag indicating if the header contains a response codde other than <see cref="DnsResponseCode.NoError"/>.
93+
/// A flag indicating if the header contains a response code other than <see cref="DnsResponseCode.NoError"/>.
9494
/// </summary>
9595
public bool HasError => Header?.ResponseCode != DnsHeaderResponseCode.NoError;
9696

src/DnsClient/DnsQuestion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace DnsClient
1111
public class DnsQuestion
1212
{
1313
/// <summary>
14-
/// Gets the domain name the lookup was runnig for.
14+
/// Gets the domain name the lookup was running for.
1515
/// </summary>
1616
/// <value>
1717
/// The name of the query.

src/DnsClient/DnsRecordFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public ResourceRecordInfo ReadRecordInfo()
4343
_reader.ReadQuestionQueryString(), // name
4444
(ResourceRecordType)_reader.ReadUInt16NetworkOrder(), // type
4545
(QueryClass)_reader.ReadUInt16NetworkOrder(), // class
46-
(int)_reader.ReadUInt32NetworkOrder(), // ttl - 32bit!!
46+
(int)_reader.ReadUInt32NetworkOrder(), // TTL - 32bit!!
4747
_reader.ReadUInt16NetworkOrder()); // RDLength
4848
}
4949

src/DnsClient/DnsString.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace DnsClient
1111
public class DnsString
1212
{
1313
/// <summary>
14-
/// The ACE prefix indicates that the domain name label contains not normally supported characters and that the label has been endoded.
14+
/// The ACE prefix indicates that the domain name label contains not normally supported characters and that the label has been encoded.
1515
/// </summary>
1616
public const string ACEPrefix = "xn--";
1717

1818
/// <summary>
19-
/// The maximum lenght in bytes for one label.
19+
/// The maximum length in bytes for one label.
2020
/// </summary>
2121
public const int LabelMaxLength = 63;
2222

2323
/// <summary>
24-
/// The maximum supported total length in bytes for a domain nanme. The calculation of the actual
24+
/// The maximum supported total length in bytes for a domain name. The calculation of the actual
2525
/// bytes this <see cref="DnsString"/> consumes includes all bytes used for to encode it as octet string.
2626
/// </summary>
2727
public const int QueryMaxLength = 255;
@@ -36,7 +36,7 @@ public class DnsString
3636
private const string DotStr = ".";
3737

3838
/// <summary>
39-
/// Gets the orginal value.
39+
/// Gets the original value.
4040
/// </summary>
4141
public string Original { get; }
4242

@@ -177,7 +177,7 @@ public static DnsString Parse(string query)
177177
}
178178
}
179179

180-
// octets length length bit per label + 2(start +end)
180+
// octets length bit per label + 2(start +end)
181181
if (charCount + labelsCount + 1 > QueryMaxLength)
182182
{
183183
throw new ArgumentException($"Octet length of '{query}' exceeds maximum of {QueryMaxLength} bytes.", nameof(query));
@@ -192,7 +192,7 @@ public static DnsString Parse(string query)
192192
}
193193

194194
/// <summary>
195-
/// Transforms names with the <see cref="ACEPrefix"/> to the unicode variant and adds a trailing '.' at the end if not present.
195+
/// Transforms names with the <see cref="ACEPrefix"/> to the Unicode variant and adds a trailing '.' at the end if not present.
196196
/// The original value will be kept in this instance in case it is needed.
197197
/// </summary>
198198
/// <remarks>

0 commit comments

Comments
 (0)