Skip to content

Commit

Permalink
Fixing minidig readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaCo committed Aug 19, 2018
1 parent 8a452db commit a174e8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion samples/MiniDig/Properties/launchSettings.json
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"MiniDig": {
"commandName": "Project",
"commandLineArgs": "-s localhost perf -s 500 "
"commandLineArgs": "google.com"
}
}
}
13 changes: 5 additions & 8 deletions samples/MiniDig/RandomCommand.cs
Expand Up @@ -14,7 +14,7 @@ namespace DigApp
{
public class RandomCommand : DnsCommand
{
private static ConcurrentQueue<string> _domainNames;
private ConcurrentQueue<string> _domainNames;
private static readonly object _nameLock = new object();
private static Random _randmom = new Random();
private int _clients;
Expand All @@ -36,17 +36,11 @@ public class RandomCommand : DnsCommand

public CommandOption SyncArg { get; private set; }

static RandomCommand()
{
var lines = File.ReadAllLines("names.txt");
_domainNames = new ConcurrentQueue<string>(lines.Select(p => p.Substring(p.IndexOf(',') + 1)));
}

public RandomCommand(CommandLineApplication app, ILoggerFactory loggerFactory, string[] originalArgs) : base(app, loggerFactory, originalArgs)
{
}

public static string NextDomainName()
public string NextDomainName()
{
while (true)
{
Expand All @@ -69,6 +63,9 @@ protected override void Configure()

protected override async Task<int> Execute()
{
var lines = File.ReadAllLines("names.txt");
_domainNames = new ConcurrentQueue<string>(lines.Select(p => p.Substring(p.IndexOf(',') + 1)));

_clients = ClientsArg.HasValue() ? int.Parse(ClientsArg.Value()) : 10;
_runtime = RuntimeArg.HasValue() ? int.Parse(RuntimeArg.Value()) <= 1 ? 5 : int.Parse(RuntimeArg.Value()) : 5;
_runSync = SyncArg.HasValue();
Expand Down
18 changes: 9 additions & 9 deletions samples/MiniDig/readme.md
Expand Up @@ -3,22 +3,22 @@ MiniDig is an example implementation of a DNS lookup command line utility which
It is supposed to work similar to the well-known `dig` command line tool on Linux, with a lot fewer options of course.

## How to Build/Run it
To run it, open a command line windows, or bash, navigate to \Samples\MiniDig and run `dotnet restore` and `dotnet run`.
To run it, open a command line windows, or bash, navigate to `/Samples/MiniDig` and run `dotnet restore` and `dotnet run`.

MiniDig is multi targeted for now, which means, when you use `dotnet run` you have to specify a framework `-f NetCoreApp20` for example.

On Linux, e.g. running it in Ubuntu, the dotnet SDK currently has bugs to resolve certain things. To build and run it, you might have to publish a self-contained output with `dotnet publish -f NetCoreApp20 --self-contained -r ubuntu-x64` for example.

## Help
`dotnet run -?` gives you the list of options and commands.
MiniDig is multi targeted for now, which means, when you use `dotnet run` you have to specify a framework
`-f NetCoreApp2.0` or `-f net472` for example.

## Examples
`dotnet run google.com ANY` to query for google.com
`dotnet run -f netcoreapp2.0 google.com ANY` to query for google.com

If nothing else is specified, it uses the DNS server configured for your local network adapter.
To specify a different server, use the `-s` switch, for example:

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


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


## Performance Testing
One subcommand `perf` can be used to run performance tests
Expand Down

0 comments on commit a174e8a

Please sign in to comment.