code: func (ra *RegistrationAuthorityImpl) checkRegistrationLimits(ctx context.Context, ip net.IP) error {
  	// Check the registrations per IP limit using the CountRegistrationsByIP SA
  	// function that matches IP addresses exactly
  	exactRegLimit := ra.rlPolicies.RegistrationsPerIP()
  	err := ra.checkRegistrationIPLimit(ctx, exactRegLimit, ip, ra.SA.CountRegistrationsByIP)
  	if err != nil {
  		ra.regByIPStats.Inc("Exceeded", 1)
  		ra.log.Infof("Rate limit exceeded, RegistrationsByIP, IP: %s", ip)
  		return err
  	}
  	ra.regByIPStats.Inc("Pass", 1)
  
  	// We only apply the fuzzy reg limit to IPv6 addresses.
  	// Per https://golang.org/pkg/net/#IP.To4 "If ip is not an IPv4 address, To4
  	// returns nil"
  	if ip.To4() != nil {
  		return nil
  	}
  
  	// Check the registrations per IP range limit using the
  	// CountRegistrationsByIPRange SA function that fuzzy-matches IPv6 addresses
  	// within a larger address range
  	fuzzyRegLimit := ra.rlPolicies.RegistrationsPerIPRange()
  	err = ra.checkRegistrationIPLimit(ctx, fuzzyRegLimit, ip, ra.SA.CountRegistrationsByIPRange)
  	if err != nil {
  		ra.regByIPRangeStats.Inc("Exceeded", 1)
  		ra.log.Infof("Rate limit exceeded, RegistrationsByIPRange, IP: %s", ip)
  		// For the fuzzyRegLimit we use a new error message that specifically
  		// mentions that the limit being exceeded is applied to a *range* of IPs
  		return berrors.RateLimitError("too many registrations for this IP range")
  	}
  	ra.regByIPRangeStats.Inc("Pass", 1)
  
  	return nil
  }
docs: // checkRegistrationLimits enforces the RegistrationsPerIP and
  // RegistrationsPerIPRange limits