Esempio n. 1
0
        public static async Task Main(string[] args)
        {
            DnsClient.Tracing.Source.Switch.Level = SourceLevels.Information;
            DnsClient.Tracing.Source.Listeners.Add(new ConsoleTraceListener());

            var app = new CommandLineApplication(throwOnUnexpectedArg: true);

            app.Command("perf", (perfApp) => new PerfCommand(perfApp, args), throwOnUnexpectedArg: true);
            app.Command("random", (randApp) => new RandomCommand(randApp, args), throwOnUnexpectedArg: true);

            var defaultCommand = new DigCommand(app, args);

            try
            {
                await app.ExecuteAsync(args).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var loggerFactory = new LoggerFactory().WithFilter(new FilterLoggerSettings()
            {
                { "Default", LogLevel.Warning }
            });
            //loggerFactory.AddConsole();

            var logFilename = $"Log/dig.log";

            try
            {
                if (File.Exists(logFilename))
                {
                    File.Delete(logFilename);
                }
            }
            catch { }

            loggerFactory.AddSerilog(new LoggerConfiguration()
                                     .Enrich.FromLogContext()
                                     .WriteTo.File(logFilename, shared: true)
                                     .CreateLogger());

            var app = new CommandLineApplication(throwOnUnexpectedArg: true);

            app.Command("perf", (perfApp) => new PerfCommand(perfApp, loggerFactory, args), throwOnUnexpectedArg: true);
            app.Command("random", (randApp) => new RandomCommand(randApp, loggerFactory, args), throwOnUnexpectedArg: true);

            var defaultCommand = new DigCommand(app, loggerFactory, args);

            try
            {
                app.Execute(args);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            //var queryResult = Interop.DNSQueryer.QueryDNSForRecordTypeSpecificNameServers(
            //                "consul.service.consul", new[] { new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8600) } , Interop.DNSQueryer.DnsRecordTypes.DNS_TYPE_A);

            //var result = Interop.DNSQueryer.QueryDNSForRecordTypeSpecificNameServers(
            //    "google.com",
            //    new[] { new IPEndPoint(IPAddress.Parse("127.0.0.1"), 53) },
            //    Interop.DNSQueryer.DnsRecordTypes.DNS_TYPE_A);

            //Console.WriteLine(result.Length + "Results");
            //if (result.Length > 0)
            //{
            //    foreach (var val in result)
            //    {
            //        foreach (var kv in val)
            //        {
            //            Console.WriteLine(kv.Key + "=" + kv.Value);
            //        }
            //    }
            //}
            //return;

            var app = new CommandLineApplication(throwOnUnexpectedArg: true);

            var perfApplication = app.Command("perf", (perfApp) => new PerfCommand2(perfApp, args), throwOnUnexpectedArg: true);

            var defaultCommand = new DigCommand(app, args);

            try
            {
                app.Execute(args);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }