private static void InitRootDnsServer()
        {   
            DnsServerSettings settings = new DnsServerSettings();
            settings.Address = "127.0.0.1";
            settings.Port = 5400;
            settings.TcpServerSettings.MaxOutstandingAccepts = 4;
            settings.TcpServerSettings.MaxActiveRequests = 16;
            settings.TcpServerSettings.ReceiveTimeout = 60 * 1000;
            settings.TcpServerSettings.SendTimeout = 60 * 1000;

            settings.UdpServerSettings.MaxOutstandingAccepts = 4;
            settings.UdpServerSettings.MaxActiveRequests = 16;
            settings.UdpServerSettings.ReceiveTimeout = 60 * 1000;
            settings.UdpServerSettings.SendTimeout = 60 * 1000;

            MemoryStore memoryDnsStore = new MemoryStore();

            DnsRecordTable table = new DnsRecordTable();
            
            // Address only
            table.Add(new NSRecord("abc.com", "127.0.0.1")); 
            table.Add(new AddressRecord("abc.com", "192.200.0.1"));
            table.Add(new AddressRecord("abc.com", "192.200.0.2"));
            
            // Cert + Address
            table.Add(new NSRecord("redmond.hsgincubator.com", "127.0.0.1"));
            table.Add(new AddressRecord("redmond.hsgincubator.com", "192.210.0.1"));
            table.Add(new CertRecord(new DnsX509Cert(File.ReadAllBytes("metadata\\certificates\\redmond.cer"))));

            // Cert MX + Address
            table.Add(new NSRecord("direct.hisp.com", "127.0.0.1"));
            table.Add(new AddressRecord("direct.hisp.com", "192.220.0.1"));
            table.Add(new MXRecord("direct.hisp.com", "gateway.direct.hisp.com"));
            

            s_recordTable = table;
            
            foreach (DnsResourceRecord record in s_recordTable.Records)
            {
                memoryDnsStore.Records.Add(record); 
            }            

            s_rootDnsServer = new TestServer(memoryDnsStore, settings);             
            s_rootDnsServer.Server.Start();            
        }
        private static void InitRootDnsServer()
        {
            DnsServerSettings settings = new DnsServerSettings();

            settings.Address = "127.0.0.1";
            settings.Port    = 5400;
            settings.TcpServerSettings.MaxOutstandingAccepts = 4;
            settings.TcpServerSettings.MaxActiveRequests     = 16;
            settings.TcpServerSettings.ReceiveTimeout        = 60 * 1000;
            settings.TcpServerSettings.SendTimeout           = 60 * 1000;

            settings.UdpServerSettings.MaxOutstandingAccepts = 4;
            settings.UdpServerSettings.MaxActiveRequests     = 16;
            settings.UdpServerSettings.ReceiveTimeout        = 60 * 1000;
            settings.UdpServerSettings.SendTimeout           = 60 * 1000;

            MemoryStore memoryDnsStore = new MemoryStore();

            DnsRecordTable table = new DnsRecordTable();

            // Address only
            table.Add(new NSRecord("abc.com", "127.0.0.1"));
            table.Add(new AddressRecord("abc.com", "192.200.0.1"));
            table.Add(new AddressRecord("abc.com", "192.200.0.2"));

            // Cert + Address
            table.Add(new NSRecord("redmond.hsgincubator.com", "127.0.0.1"));
            table.Add(new AddressRecord("redmond.hsgincubator.com", "192.210.0.1"));
            table.Add(new CertRecord(new DnsX509Cert(File.ReadAllBytes("metadata\\certificates\\redmond.cer"))));

            // Cert MX + Address
            table.Add(new NSRecord("direct.hisp.com", "127.0.0.1"));
            table.Add(new AddressRecord("direct.hisp.com", "192.220.0.1"));
            table.Add(new MXRecord("direct.hisp.com", "gateway.direct.hisp.com"));


            s_recordTable = table;

            foreach (DnsResourceRecord record in s_recordTable.Records)
            {
                memoryDnsStore.Records.Add(record);
            }

            s_rootDnsServer = new TestServer(memoryDnsStore, settings);
            s_rootDnsServer.Server.Start();
        }
Exemplo n.º 3
0
        public static void AddTestRecords(DnsRecordTable store)
        {
            // Addresses
            store.Add(new AddressRecord("foo.com", "192.169.0.1"));
            store.Add(new AddressRecord("foo.com", "192.169.0.2"));
            store.Add(new AddressRecord("foo.com", "192.169.0.3"));
            store.Add(new AddressRecord("bar.com", "192.168.0.1"));
            store.Add(new AddressRecord("goo.com", "192.167.0.1"));
            store.Add(new AddressRecord("goo.com", "192.167.0.2"));
            store.Add(new AddressRecord("localhost", "127.0.0.1"));
            store.Add(new AddressRecord("bigrecord.com", "1.2.3.4"));

            const string BigString = "0123456789abcdefghijklmnop";
            TextRecord   txt       = new TextRecord("goo.com", new string[] { BigString, "One_" + BigString, "Two_" + BigString });

            store.Add(txt);

            StringBuilder builder = new StringBuilder(64);

            for (int i = 0; i < 64; ++i)
            {
                builder.Append('a');
            }
            string bigTextString = builder.ToString();

            string[] textStrings = new string[128];
            for (int i = 0; i < textStrings.Length; ++i)
            {
                textStrings[i] = bigTextString;
            }
            store.Add(new TextRecord("bigrecord.com", textStrings));

            store.Add(new SRVRecord("foo.com", 20, 353, "x.y.z.com"));
            store.Add(new MXRecord("goo.com", "foo.bar.xyz"));
        }
Exemplo n.º 4
0
 public static void AddTestRecords(DnsRecordTable store)
 {
     // Addresses
     store.Add(new AddressRecord("foo.com", "192.169.0.1"));
     store.Add(new AddressRecord("foo.com", "192.169.0.2"));
     store.Add(new AddressRecord("foo.com", "192.169.0.3"));
     store.Add(new AddressRecord("bar.com", "192.168.0.1"));
     store.Add(new AddressRecord("goo.com", "192.167.0.1"));
     store.Add(new AddressRecord("goo.com", "192.167.0.2"));
     store.Add(new AddressRecord("localhost", "127.0.0.1"));
     store.Add(new AddressRecord("bigrecord.com", "1.2.3.4"));
     
     const string BigString = "0123456789abcdefghijklmnop";
     TextRecord txt = new TextRecord("goo.com", new string[] { BigString, "One_" + BigString, "Two_" + BigString});
     store.Add(txt);
     
     StringBuilder builder = new StringBuilder(64);
     for (int i = 0; i < 64; ++i)
     {
         builder.Append('a');
     }
     string bigTextString = builder.ToString();
     string[] textStrings = new string[128];
     for (int i = 0; i < textStrings.Length; ++i)
     {
         textStrings[i] = bigTextString;
     }
     store.Add(new TextRecord("bigrecord.com", textStrings)); 
     
     store.Add(new SRVRecord("foo.com", 20, 353, "x.y.z.com"));            
     store.Add(new MXRecord("goo.com", "foo.bar.xyz"));
 }