// NotMultipleOf error for when multiple of validation fails
346792
func NotMultipleOf(name, in string, multiple interface{}) *Validation {
	var msg string
	if in == "" {
		msg = fmt.Sprintf(multipleOfFailNoIn, name, multiple)
	} else {
		msg = fmt.Sprintf(multipleOfFail, name, in, multiple)
	}
	return &Validation{
		code:    MultipleOfFailCode,
		Name:    name,
		In:      in,
		Value:   multiple,
		message: msg,
	}
}
519606
func hasMultipleAuth(r *http.Request) bool {
	authTypeCount := 0
	for _, hasValidAuth := range []func(*http.Request) bool{isRequestSignatureV2, isRequestPresignedSignatureV2, isRequestSignatureV4, isRequestPresignedSignatureV4, isRequestJWT, isRequestPostPolicySignatureV4} {
		if hasValidAuth(r) {
			authTypeCount++
		}
	}
	return authTypeCount > 1
}
622847
func ParseMultiple(headers []string) Links {
	links := make(Links, 0)
	for _, header := range headers {
		links = append(links, Parse(header)...)
	}
	return links
}
508063
func (s *Service) UnsubscribeMultiple(topics []string) GenericFuture {
	s.mutex.Lock()
	defer s.mutex.Unlock()

	// remove subscription
	for _, v := range topics {
		s.subscriptions.Empty(v)
	}

	// allocate future
	f := future.New()

	// queue unsubscribe
	s.commandQueue <- &command{
		unsubscribe: true,
		future:      f,
		topics:      topics,
	}

	return f
}
362276
func MultipleErrors(prefix string, errs []error) string {
	buf := &bytes.Buffer{}
	for _, err := range errs {
		fmt.Fprintf(buf, "%s%v\n", prefix, messageForError(err))
	}
	return buf.String()
}
1215783
func WeakMultiplex(output SimpleInChannel, inputs ...SimpleOutChannel) {
	if len(inputs) == 0 {
		panic("channels: WeakMultiplex requires at least one input")
	}
	go multiplex(output, inputs, false)
}
675265
func getStringMultipleStrict(labels map[string]string, labelNames ...string) (map[string]string, error) {
	foundLabels := map[string]string{}
	for _, name := range labelNames {
		value := getStringValue(labels, name, "")
		// Error out only if one of them is not defined.
		if len(value) == 0 {
			return nil, fmt.Errorf("label not found: %s", name)
		}
		foundLabels[name] = value
	}
	return foundLabels, nil
}
606924
func (r *rpcHandler) handleMultiplex(ctx context.Context, conn net.Conn, rpcCtx *RPCContext) {
	defer func() {
		// Remove any potential mapping between a NodeID to this connection and
		// close the underlying connection.
		r.removeNodeConn(rpcCtx)
		conn.Close()
	}()

	conf := yamux.DefaultConfig()
	conf.LogOutput = nil
	conf.Logger = r.gologger
	server, err := yamux.Server(conn, conf)
	if err != nil {
		r.logger.Error("multiplex failed to create yamux server", "error", err)
		return
	}

	// Update the context to store the yamux session
	rpcCtx.Session = server

	// Create the RPC server for this connection
	rpcServer := rpc.NewServer()
	r.setupRpcServer(rpcServer, rpcCtx)

	for {
		// stop handling connections if context was cancelled
		if ctx.Err() != nil {
			return
		}

		sub, err := server.Accept()
		if err != nil {
			if err != io.EOF {
				r.logger.Error("multiplex conn accept failed", "error", err)
			}
			return
		}
		go r.handleNomadConn(ctx, sub, rpcServer)
	}
}
496316
func parseMultivalueLine(line string) (values []string) {
	if !strings.HasPrefix(line, `"`) || !strings.HasSuffix(line, `"`) {
		return []string{line}
	}

	var v bytes.Buffer
	w := false // check whether we're within quotes or not
	for _, e := range []byte(line) {
		// ignore quotes
		if e == '"' {
			w = !w
			continue
		}

		if e == ' ' {
			if !w { // between quoted values, keep the previous value and reset.
				values = append(values, v.String())
				v.Reset()
				continue
			}
		}

		v.WriteByte(e)
	}

	values = append(values, v.String())

	return
}
724122
func nextMultiNorm(i *Iter) []byte {
	j := 0
	d := i.multiSeg
	for j < len(d) {
		info := i.rb.f.info(input{bytes: d}, j)
		if info.BoundaryBefore() {
			i.rb.compose()
			seg := i.buf[:i.rb.flushCopy(i.buf[:])]
			i.rb.ss.first(info)
			i.rb.insertUnsafe(input{bytes: d}, j, info)
			i.multiSeg = d[j+int(info.size):]
			return seg
		}
		i.rb.ss.next(info)
		i.rb.insertUnsafe(input{bytes: d}, j, info)
		j += int(info.size)
	}
	i.multiSeg = nil
	i.next = nextComposed
	return doNormComposed(i)
}
1264865
func (req *Request) ParseMultipartForm(_ int64) (e error) {
	var s ServerMultipartForm
	if s, e = req.GetMultipartForm(); e == nil {
		req.MultipartForm = newMultipareForm(s)
	}
	return
}
93676
func validateLimit(v, min, max int) error {

	// ensure the value for `limit` is valid
	if v < min || v > max {
		err := fmt.Errorf("%d is not a valid value for `limit`, must be between %d-%d (inclusive).", v, min, max)
		return err
	}

	return nil
}
1210276
func GetMultipleFields(r *http.Request, fieldName string) ([]string, error) {
	var values = []string{}

	for field, value := range r.Form {
		// Strip the square brackets.
		if multiParamRegex.ReplaceAllString(field, "$1") == fieldName {
			values = append(values, value...)
		}
	}

	if len(values) == 0 {
		return []string{}, MissingFieldError{fieldName}
	}

	return values, nil
}
323466
func OneOf(choices []string) Func {
	return func(input string) error {
		for _, v := range choices {
			if input == v {
				return nil
			}
		}

		return NewValidationError(fmt.Sprintf("%s is not a valid option.", input))
	}
}
108594
func ValidateNonEmptyStrings(err error, slice ...string) Validatable {
	return func() error {
		if slice == nil || len(slice) == 0 {
			return err
		}
		return nil
	}
}
539263
func NotBlank(fl validator.FieldLevel) bool {
	field := fl.Field()

	switch field.Kind() {
	case reflect.String:
		return len(strings.TrimSpace(field.String())) > 0
	case reflect.Chan, reflect.Map, reflect.Slice, reflect.Array:
		return field.Len() > 0
	case reflect.Ptr, reflect.Interface, reflect.Func:
		return !field.IsNil()
	default:
		return field.IsValid() && field.Interface() != reflect.Zero(field.Type()).Interface()
	}
}
1223710
func SplitMultiElement(r rune) ([]rune, bool) {
	r = CompatJamo(r)
	es, ok := multiElements[r]
	return es, ok
}