예제 #1
0
        public void TestValidation()
        {
            DnsRequest request = DnsRequest.CreateA("foo.com");

            Assert.Null(Record.Exception(() => request.Validate()));
            request.Header.IsRequest = false;
            Assert.Throws <DnsProtocolException>(() => request.Validate());
        }
        public void CreateAResponseDumps(string domain)
        {
            DnsBuffer buff = new DnsBuffer(DnsStandard.MaxUdpMessageLength * 2);

            m_client.Resolve(DnsRequest.CreateA(domain)).Serialize(buff);
            byte[] bytes = buff.CreateReader().ReadBytes();
            string path  = Path.Combine(DnsResponsePath, string.Format("aname.{0}.bin", domain)).Replace("www.", "");

            Console.WriteLine("Creating {0}", path);
            using (FileStream s = new FileStream(path, FileMode.OpenOrCreate)){
                s.Write(bytes
                        , 0
                        , bytes.Length);
                s.Close();
            }
        }
예제 #3
0
 public void TestA(string domain)
 {
     Resolve(DnsRequest.CreateA(domain));
 }