Exemplo n.º 1
0
        private void TestARecord()
        {
            // Add and check a A Record
            ShamanDNSCLient cli = new ShamanDNSCLient(null);

            cli.AddRecord(new DNSEntry
            {
                Domain = "xxx2.provina.it",
                Name   = "XXX",
                Value  = "127.0.0.2",
                Type   = "A"
            }).Wait();

            //var addresses = Dns.GetHostEntry("xxx2.provina.it").AddressList;
            //var iplist = string.Join(' ', addresses.Select(x=>x.MapToIPv4().ToString()));
            //Console.WriteLine(iplist);
        }
Exemplo n.º 2
0
        private void TestDNSRecord()
        {
            // Add and read a TXT record
            cli.AddRecord(new DNSEntry
            {
                Domain = "xxx2.provina.it",
                Name   = "XXX",
                Value  = "Got it!",
                Type   = "TXT"
            }).Wait();

            var lookup = new LookupClient();
            var result = lookup.QueryAsync("xxx2.provina.it", QueryType.TXT).Result;

            var record = result.Answers.Cast <TxtRecord>().FirstOrDefault();
            var ip     = string.Join(" ", record?.Text);

            Console.WriteLine(ip);
        }