Exemple #1
0
        private async Task <bool> DoesIPMatchAppIPAsync()
        {
            Nest.Model.AppDomain defaultDomain = (from domain in AppViewModel.DomainViewModel.Domains
                                                  where domain.Default == true
                                                  select domain).First();

            if (!await Dns.IsDomainIPAsync(Name.Text, defaultDomain.IPAddress))
            {
                IsServiceActive = false;
                await ErrorHandler.ExceptionAsync(this, "The domain name " + Name.Text +
                                                  " currently does not resolve to " + defaultDomain.IPAddress +
                                                  ". Make sure to update the DNS");

                return(false);
            }

            string unmatchedAlias = await Dns.GetUnmatchedDomainAliasIPAsync(
                Aliases.Text, defaultDomain.IPAddress);

            if (unmatchedAlias != null)
            {
                IsServiceActive = false;
                await ErrorHandler.ExceptionAsync(this, "The alias " + unmatchedAlias +
                                                  " currently does not resolve to " + defaultDomain.IPAddress +
                                                  ". Make sure to update the DNS");

                return(false);
            }

            return(true);
        }
        private async Task <bool> IsDnsOkAsync()
        {
            Nest.Model.AppDomain defaultDomain = (from domain in AppViewModel.DomainViewModel.Domains
                                                  where domain.Default == true
                                                  select domain).First();

            foreach (Nest.Model.AppDomain domain in AppViewModel.DomainViewModel.Domains)
            {
                if (domain.Default)
                {
                    continue;
                }

                if (!await Dns.IsDomainIPAsync(domain.Name, defaultDomain.IPAddress))
                {
                    await ErrorHandler.ExceptionAsync(this, "The domain name " + domain.Name +
                                                      " currently does not resolve to " + defaultDomain.IPAddress +
                                                      ". Make sure to update the DNS");

                    return(false);
                }

                string unmatchedAlias = await Dns.GetUnmatchedDomainAliasIPAsync(
                    domain.Aliases, defaultDomain.IPAddress);

                if (unmatchedAlias != null)
                {
                    await ErrorHandler.ExceptionAsync(this, "The alias " + unmatchedAlias +
                                                      " currently does not resolve to " + defaultDomain.IPAddress +
                                                      ". Make sure to update the DNS");

                    return(false);
                }
            }

            return(true);
        }