Returns a new instance of Domain

 @param domain [String] The domain name.

 @example EmailChecker::Domain.new('google.com')
 Checks if the domian exists and has valid MX and A records.

 @return [Boolean]
437979
def valid?
      return false unless @domain
      Timeout.timeout(SERVER_TIMEOUT) do
        return true if valid_mx_records?
        return true if a_records?
      end
    rescue Timeout::Error, Errno::ECONNREFUSED
      false
    end
1216538
def _domain_check(domain, domain_list, resolve):
    
    if domain in domain_list:
        return True
    if resolve:
        for exchange in _get_mx_exchanges(domain):
            for value in domain_list:
                if exchange.endswith(value):
                    return True
    return False
751857
def get_mx_records(domain):
        

        DNS.DiscoverNameServers()
        request = DNS.Request()
        response = request.req(name=domain, qtype=DNS.Type.MX)

        mx_records = []
        for answer in response.answers:
            mx_records.append(MXRecord(priority=answer['data'][0], exchange=answer['data'][1], domain=domain))

        return sorted(mx_records, key=lambda record: record.priority)
1058799
def allowed?(to, from)
      to, from = JID.new(to), JID.new(from)
      return false                      if to.empty? || from.empty?
      return true                       if to.domain == from.domain # same domain always allowed
      return cross_domain?(to, from)    if local_jid?(to, from)     # both virtual hosted here
      return check_subdomains(to, from) if subdomain?(to, from)     # component/pubsub to component/pubsub
      return check_subdomain(to, from)  if subdomain?(to)           # to component/pubsub
      return check_subdomain(from, to)  if subdomain?(from)         # from component/pubsub
      return cross_domain?(to)          if local_jid?(to)           # from is remote
      return cross_domain?(from)        if local_jid?(from)         # to is remote
      return false
    end
318829
def challenge_record_valid?(domain, key)
      record = challenge_record(domain)
      return record && record.data == key
    end
1374227
private IDomain createDomainIfNotExist(String domainId){
        IDomain foundDomain=findDomainByID(domainId);
        if(foundDomain==null){
            foundDomain=user.createDomain(domainName);
        }
        return foundDomain;
    }
958363
def subdomain?(*jids)
      !jids.flatten.index do |jid|
        !component?(jid) && !pubsub?(jid)
      end
    end
461308
def domain_search(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.search_domains(**kwargs)
932547
def is_subdomain(domain, reference):
    
    index_of_reference = domain.find(reference)
    if index_of_reference > 0 and domain[index_of_reference:] == reference:
        return True
    return False
353940
def from_domain(cls, domain, version=None, require_https=True):
        
        url = 'https://' + domain + '/api/hive.json'
        try:
            return cls.from_url(url, version=version, require_https=require_https)
        except MissingHive:
            url = 'http://' + domain + '/api/hive.json'
            return cls.from_url(url, version=version, require_https=require_https)
640302
def local_jid?(*jids)
      !jids.flatten.index do |jid|
        !vhost?(JID.new(jid).domain)
      end
    end
75021
def create(domain, action, url = '')
      res = @client.post("domains/#{domain}/webhooks", id: action, url: url)
      res.to_h['webhook']['url'] == url && res.to_h['message'] == 'Webhook has been created'
    end
586180
function isDomainValid (domain) {
  if (!domain) {
    return false
  }

  const [min, max] = domain
  const isValid = isPresent(min) && !isNaN(min) && isPresent(max) && !isNaN(max)
  if (!isValid) {
    Logger.debug(`Invalid domain: [${min}, ${max}]`)
  }

  return isValid
}
1089894
def query_domain(self, domain, typenames, domainquerytype='list', count=False):
        

        objects = self._get_repo_filter(Layer.objects)

        if domainquerytype == 'range':
            return [tuple(objects.aggregate(Min(domain), Max(domain)).values())]
        else:
            if count:
                return [(d[domain], d['%s__count' % domain])
                        for d in objects.values(domain).annotate(Count(domain))]
            else:
                return objects.values_list(domain).distinct()
731264
def get(cls, dname):
        
        Domain = cls
        dname = dname.hostname if hasattr(dname, 'hostname') else dname.lower()
        return Session.query(Domain).filter(Domain.name == dname).first()
208571
def create(server_context, domain_definition, container_path=None):
    # type: (ServerContext, dict, str) -> Domain
    
    url = server_context.build_url('property', 'createDomain.api', container_path=container_path)

    headers = {
        'Content-Type': 'application/json'
    }

    domain = None

    raw_domain = server_context.make_request(url, json_dumps(domain_definition), headers=headers)

    if raw_domain is not None:
        domain = Domain.from_data(raw_domain)

    return domain
559527
def select
      new_instance = self.class.new
      if block_given?
        @data.each { |k,v| new_instance.data[k] = v if yield(k,v) }
      end
      return new_instance
    end