コード例 #1
0
ファイル: RetryTester.cs プロジェクト: DM-TOR/nhin-d
 static RetryTester()
 {
     s_failureStore = new FailureStore(TestStore.Default.Store);
     DnsServerSettings settings = new DnsServerSettings();
     settings.Address = "127.0.0.1";
     settings.Port = 5373;
     
     s_failureServer = new TestServer(s_failureStore, settings);
     s_failureServer.Server.Start();
 }
コード例 #2
0
ファイル: TestServer.cs プロジェクト: DM-TOR/nhin-d
        static TestServer()
        {
            DefaultSettings = new DnsServerSettings();
            DefaultSettings.Address = "127.0.0.1";
            DefaultSettings.Port = 5353;
            DefaultSettings.TcpServerSettings.MaxOutstandingAccepts = 4;
            DefaultSettings.TcpServerSettings.MaxActiveRequests = 16;
            DefaultSettings.TcpServerSettings.ReceiveTimeout = 60 * 1000;
            DefaultSettings.TcpServerSettings.SendTimeout= 60 * 1000;
            
            DefaultSettings.UdpServerSettings.MaxOutstandingAccepts = 4;
            DefaultSettings.UdpServerSettings.MaxActiveRequests = 16;
            DefaultSettings.UdpServerSettings.ReceiveTimeout = 60 * 1000;
            DefaultSettings.UdpServerSettings.SendTimeout = 60 * 1000;

            Default = new TestServer(TestStore.Default.Store);
            Default.Server.Start();
        }
コード例 #3
0
        private static void InitAuthoritativeResolver()
        {
            // Setup the authoritative resolver.
            // Primary name server is on 127.0.0.1:5400.  
            AuthoritativeResolutionSettings settings = new AuthoritativeResolutionSettings()
            {
                Cache = true,
                DnsResolutionPort = 5400, // perform DNS resolutions on 5400
                PrimaryNameServer = new DnsIPEndpointSettings[] { new DnsIPEndpointSettings("127.0.0.1", 5400) },
                TimeoutMilliseconds = 30000
            };

            // Create the authoritative resolver. 
            AuthoritativeRecordResolver resolver = new AuthoritativeRecordResolver(settings);

            // Setup DNS server to host the authoritative resolver at 127.0.0.1:5401
            DnsServerSettings dnsServerSettings = new DnsServerSettings();
            dnsServerSettings.Address = "127.0.0.1";
            dnsServerSettings.Port = 5401;

            s_authoritativeResolverServer = new TestServer(resolver, dnsServerSettings);            
            s_authoritativeResolverServer.Server.Start();
        }
コード例 #4
0
        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();            
        }