public static DNSServerModel FromServer(DNSManagement.Server server)
        {
            var model = new DNSServerModel();

            model.ServerName         = server.Name;
            model.ServerIPAddresses  = server.ServerAddresses;
            model.ListenAddresses    = server.ListenAddresses;
            model.Forwarders         = ResolvedServer.FromIPs(server.Forwarders);
            model.IsSlave            = server.IsSlave;
            model.Version            = server.Version.ToString();
            model.NoRecursion        = server.NoRecursion;
            model.BindSecondaries    = server.BindSecondaries;
            model.StrictFileParsing  = server.StrictFileParsing;
            model.RoundRobin         = server.RoundRobin;
            model.LocalNetPriority   = server.LocalNetPriority;
            model.SecureResponses    = server.SecureResponses;
            model.NameCheckFlag      = server.NameCheckFlag;
            model.BootMethod         = server.BootMethod;
            model.ScavengingInterval = server.ScavengingInterval;
            model.LogLevel           = server.LogLevel;
            model.LogIPFilterList    = server.LogIPFilterList;
            model.LogFilePath        = server.LogFilePath;
            model.LogFileMaxSize     = server.LogFileMaxSize;
            model.EventLogLevel      = server.EventLogLevel;

            //convert root hints to list for display
            List <ResolvedServer> roothintslist = new List <ResolvedServer>();
            var rhints = server.GetRootHints();

            foreach (var rh in rhints)
            {
                var records = rh.GetRecords();
                foreach (var r in records.Where(i => i.DomainName == "..RootHints"))
                {
                    if (r.ResourceRecordType != DNSManagement.RR.ResourceRecord.ResourceRecordEnum.NS)
                    {
                        continue;
                    }
                    var ns  = ((DNSManagement.RR.NSType)r.UnderlyingRecord);
                    var nsa = (records.Where(i => i.RecordType == typeof(DNSManagement.RR.AType) && ((DNSManagement.RR.AType)i.UnderlyingRecord).OwnerName == ns.NSHost)).Select(i => ((DNSManagement.RR.AType)i).IPAddress).ToList();
                    nsa.AddRange((records.Where(i => i.RecordType == typeof(DNSManagement.RR.AAAAType) && ((DNSManagement.RR.AAAAType)i.UnderlyingRecord).OwnerName == ns.NSHost)).Select(i => ((DNSManagement.RR.AAAAType)i).IPv6Address).ToArray());


                    roothintslist.Add(new ResolvedServer
                    {
                        ServerName = ns.NSHost,
                        IPAddress  = string.Join(", ", nsa.ToArray())
                    });
                }
            }
            model.RootHints = roothintslist.ToArray();

            return(model);
        }
Beispiel #2
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     Log("Connecting to server..");
     server = new DNSManagement.Server("DNSSRV", "Administrator", "Pass@word1");
     Log("Connected");
 }
Beispiel #3
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     Log("Connecting to server..");
     server = new DNSManagement.Server("DNSSRV", "Administrator", "Pass@word1");
     Log("Connected");
 }