Skip to content

Commit

Permalink
1.3.0 Progress - bug-fixes and enhancements (#57)
Browse files Browse the repository at this point in the history
* some minor things

* + Removing the disable server logic which was a bit wanky.
+ Removing cache by server. In DNS all servers should have the same answer for a question, no need to cache per server!
+ (work in progress) keep API stable (from 1.1.0 on), adding unit tests
+ (work in progress) query options & tests

* * Added max cache timeout which can be used to set an upper limit how long any records should be cached. see #48
* Fixing a bug with non-empty OPT records, see #55.
* Changing the logic which removed the EDNS opt record from the results. The record will now be in the additonal records and can have data (the raw bytes).
* Added version compatibility testing to make sure I'm not breaking stuff. Optional parameters are not fun sometimes ~~

* Update azure-pipelines-ci.yml for Azure Pipelines

* Update azure-pipelines-ci.yml for Azure Pipelines

* cleanup

* Update azure-pipelines-ci.yml for Azure Pipelines

* Update azure-pipelines-ci.yml for Azure Pipelines

* Update azure-pipelines-ci.yml for Azure Pipelines

* trying to fix build part 10

* another build update

* Readme update

* Update azure-pipelines-ci.yml pack build config

* trying to change nuget versioning

* Update azure-pipelines-ci.yml for Azure Pipelines

* Update azure-pipelines-ci.yml for Azure Pipelines

* Test build pack

* Test build pack - version suffix somehow teleports from one task to another?

* Test build pack - version suffix somehow teleports from one task to another?

* Test build pack - version suffix somehow teleports from one task to another?

* Test build pack - version suffix somehow teleports from one task to another?

* Test build pack - version suffix somehow teleports from one task to another?

2nd pack still doesn't work, just ignores anything passed into arguments it seems?

* Test build pack - version suffix somehow teleports from one task to another?

2nd pack still doesn't work, just ignores anything passed into arguments it seems?

* Test build pack - version suffix somehow teleports from one task to another?

2nd pack still doesn't work, just ignores anything passed into arguments it seems?

* new pack script

* new pack script - publish

seems to finally work, testing publish now

* changing to new icon tag

* Update azure-pipelines-ci.yml for Azure Pipelines

* testing multiple jobs

* build configuration not working

* build configuration..

* multi build

* multi build

* multi build targeting

* disabling testing on linux for now

* add master branch as trigger

[skip ci]
  • Loading branch information
MichaCo authored Mar 2, 2020
1 parent 0f4c70b commit 33ec9d2
Show file tree
Hide file tree
Showing 79 changed files with 1,645 additions and 1,545 deletions.
18 changes: 13 additions & 5 deletions DnsClientDotNet.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3D3BE1AD-F551-420A-A81D-4CB88286C8CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B5380A3E-7532-46C4-A510-694D2612B71F}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
azure-pipelines-ci.yml = azure-pipelines-ci.yml
LICENSE = LICENSE
README.md = README.md
EndProjectSection
Expand Down Expand Up @@ -40,10 +41,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DnsClient.TestsCommon", "te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DnsClient.PerfTestHost", "test\DnsClient.PerfTestHost\DnsClient.PerfTestHost.csproj", "{58173158-2B2D-4C26-A666-495641477066}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiDesign.OldReference", "test\ApiDesign.OldReference\ApiDesign.OldReference.csproj", "{77554E92-95AB-404F-8999-A82BE4978361}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Expand Down Expand Up @@ -77,6 +77,10 @@ Global
{58173158-2B2D-4C26-A666-495641477066}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58173158-2B2D-4C26-A666-495641477066}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58173158-2B2D-4C26-A666-495641477066}.Release|Any CPU.Build.0 = Release|Any CPU
{77554E92-95AB-404F-8999-A82BE4978361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77554E92-95AB-404F-8999-A82BE4978361}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77554E92-95AB-404F-8999-A82BE4978361}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77554E92-95AB-404F-8999-A82BE4978361}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -89,6 +93,7 @@ Global
{7461E2C7-008E-4E61-ABC3-AF85DE37084B} = {34E43CED-3DF4-49CE-8556-69225ABD84E6}
{8422A76D-CC40-4B4B-AA03-C17C3D86A073} = {34E43CED-3DF4-49CE-8556-69225ABD84E6}
{58173158-2B2D-4C26-A666-495641477066} = {34E43CED-3DF4-49CE-8556-69225ABD84E6}
{77554E92-95AB-404F-8999-A82BE4978361} = {34E43CED-3DF4-49CE-8556-69225ABD84E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E26DC1C5-A82B-4984-88DB-107C9D66271F}
Expand All @@ -102,4 +107,7 @@ Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var address = record?.Address;

## Builds

[![Build status](https://ci.appveyor.com/api/projects/status/y1nlxim8tkv7w3f4?svg=true)](https://ci.appveyor.com/project/MichaCo/dnsclient-net)
[![Build Status](https://dev.azure.com/michaco/DnsClient/_apis/build/status/MichaCo.DnsClient.NET?branchName=dev)](https://dev.azure.com/michaco/DnsClient/_build/latest?definitionId=1&branchName=dev)

Get it via NuGet https://www.nuget.org/packages/DnsClient/

Expand Down
76 changes: 54 additions & 22 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,66 @@
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
name: '$(Date:yyyyMMdd)$(Rev:.r)'

trigger:
- dev
- master

pool:
vmImage: 'windows-latest'
# pool:
# vmImage: 'windows-latest'

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
versionSuffix: 'beta-$(Build.BuildNumber)'

steps:
- task: NuGetToolInstaller@1
jobs:
- job: 'Linux'
displayName: 'Build on Ubuntu'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: |
src/**/*.csproj
arguments: '-c Release -f netstandard2.0'
name: 'Build'
displayName: 'build sources'

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
# TODO: re-work unit tests to run without unpredictable local DNS results or run bind on those build agents?
# - task: DotNetCoreCLI@2
# inputs:
# command: 'test'
# projects: 'test/DnsClient.Tests/*.csproj'
# publishTestResults: true
# arguments: '-c Release -f netcoreapp3.0'

- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: ''
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- job: Windows
displayName: 'Build & Test on Windows'
pool:
vmImage: 'windows-latest'

- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: |
src/**/*.csproj
test/DnsClient.Tests/*.csproj
arguments: '-c Release'
name: 'Build'
displayName: 'dotnet build'
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: 'test/DnsClient.Tests/*.csproj'
publishTestResults: true
arguments: '-c Release --no-build --no-restore'

- script: 'dotnet pack src\DnsClient\DnsClient.csproj -c Release --no-build --no-restore --version-suffix $(versionSuffix) -v normal -o $(Build.ArtifactStagingDirectory)'
name: 'PackBeta'
displayName: 'dotnet pack for beta'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'beta'
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/MiniDig/DigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using DnsClient;
using Microsoft.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;

namespace DigApp
Expand Down
29 changes: 24 additions & 5 deletions samples/MiniDig/DnsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using DnsClient;
using DnsClient.Protocol;
using Microsoft.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;

namespace DigApp
Expand Down Expand Up @@ -35,6 +36,8 @@ public abstract class DnsCommand

public CommandOption MinimumTTLArg { get; set; }

public CommandOption MaximumTTLArg { get; set; }

public CommandOption NoRecurseArg { get; set; }

public string[] OriginalArgs { get; }
Expand Down Expand Up @@ -114,22 +117,33 @@ public LookupClientOptions GetLookupSettings()
NameServers = GetEndpointsValue(),
Recursion = GetUseRecursionValue(),
Retries = GetTriesValue(),
Timeout = TimeSpan.FromMilliseconds(GetTimeoutValue()),
Timeout = Timeout.InfiniteTimeSpan, // TimeSpan.FromMilliseconds(GetTimeoutValue()),
MinimumCacheTimeout = GetMinimumTTL(),
UseCache = GetUseCache(),
UseTcpOnly = GetUseTcp(),
UseTcpFallback = !GetNoTcp()
UseTcpFallback = !GetNoTcp(),
MaximumCacheTimeout = GetMaximumTTL()
};
}

public TimeSpan GetMinimumTTL()
public TimeSpan? GetMinimumTTL()
{
if (MinimumTTLArg.HasValue())
{
return TimeSpan.FromMilliseconds(int.Parse(MinimumTTLArg.Value()));
}

return TimeSpan.Zero;
return null;
}

public TimeSpan? GetMaximumTTL()
{
if (MaximumTTLArg.HasValue())
{
return TimeSpan.FromMilliseconds(int.Parse(MaximumTTLArg.Value()));
}

return null;
}

public int GetTimeoutValue() => ConnectTimeoutArg.HasValue() ? int.Parse(ConnectTimeoutArg.Value()) : 5000;
Expand Down Expand Up @@ -184,6 +198,11 @@ protected virtual void Configure()
"Minimum cache ttl.",
CommandOptionType.SingleValue);

MaximumTTLArg = App.Option(
"--maxttl",
"Maximum cache ttl.",
CommandOptionType.SingleValue);

App.HelpOption("-? | -h | --help");
}

Expand Down
21 changes: 10 additions & 11 deletions samples/MiniDig/MiniDig.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<AssemblyName>MiniDig</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>MiniDig</PackageId>
Expand All @@ -20,27 +20,26 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.5.1" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
<DefineConstants>$(DefineConstants);PORTABLE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<DefineConstants>$(DefineConstants);PORTABLE</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.2" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/MiniDig/PerfCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using DnsClient;
using Microsoft.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;

namespace DigApp
Expand Down Expand Up @@ -59,7 +59,7 @@ protected override async Task<int> Execute()
_running = true;

Console.WriteLine($"; <<>> Starting perf run with {_clients} clients running for {_runtime} seconds <<>>");
Console.WriteLine($"; ({_settings.NameServers.Count} Servers, caching:{_settings.UseCache}, minttl:{_settings.MinimumCacheTimeout?.TotalMilliseconds})");
Console.WriteLine($"; ({_settings.NameServers.Count} Servers, caching:{_settings.UseCache}, minttl:{_settings.MinimumCacheTimeout?.TotalMilliseconds}, maxttl:{_settings.MaximumCacheTimeout?.TotalMilliseconds})");
_spinner = new Spiner();
_spinner.Start();

Expand Down
3 changes: 1 addition & 2 deletions samples/MiniDig/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;
using Serilog;

Expand Down
2 changes: 1 addition & 1 deletion samples/MiniDig/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"MiniDig": {
"commandName": "Project",
"commandLineArgs": "google.com"
"commandLineArgs": "--cache -s localhost --tcp --maxttl 5 mcnet.com any "
}
}
}
2 changes: 1 addition & 1 deletion samples/MiniDig/RandomCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using DnsClient;
using Microsoft.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;

namespace DigApp
Expand Down
11 changes: 7 additions & 4 deletions src/DnsClient/DnsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Product>DnsClient.NET</Product>
<Description>DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups</Description>

<Copyright>Copyright (c) 2017 MichaConrad</Copyright>
<Copyright>Copyright (c) 2020 MichaConrad</Copyright>
<Authors>MichaCo</Authors>
<AssemblyName>DnsClient</AssemblyName>

Expand All @@ -20,18 +20,21 @@
<PackageId>DnsClient</PackageId>
<PackageTags>dns;client;stub;resolver;name;server;core;service;discovery</PackageTags>

<PackageIconUrl>http://dnsclient.michaco.net/favicon-196x196.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>http://dnsclient.michaco.net</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/MichaCo/DnsClient.NET/blob/master/LICENSE</PackageLicenseUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<WebPage>http://dnsclient.michaco.net</WebPage>

<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/MichaCo/DnsClient.NET</RepositoryUrl>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>7.2</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.4.0" />
</ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/DnsClient/DnsDatagramReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using DnsClient.Internal;

Expand Down
Loading

0 comments on commit 33ec9d2

Please # to comment.