// SrcIpIs returns a ReqCondition testing whether the source IP of the request is one of the given strings
335995
func SrcIpIs(ips ...string) ReqCondition {
	return ReqConditionFunc(func(req *http.Request, ctx *ProxyCtx) bool {
		for _, ip := range ips {
			if strings.HasPrefix(req.RemoteAddr, ip+":") {
				return true
			}
		}
		return false
	})
}
937770
func (schema *Schema) TypeIs(typeName string) bool {
	if schema.Type != nil {
		// the schema Type is either a string or an array of strings
		if schema.Type.String != nil {
			return (*(schema.Type.String) == typeName)
		} else if schema.Type.StringArray != nil {
			for _, n := range *(schema.Type.StringArray) {
				if n == typeName {
					return true
				}
			}
		}
	}
	return false
}
396387
func selectHeaderAccept(accepts []string) string {
	if len(accepts) == 0 {
		return ""
	}

	if contains(accepts, "application/json") {
		return "application/json"
	}

	return strings.Join(accepts, ",")
}
716295
func dnsDomainIs(host, domain string) bool {
	if len(host) < len(domain) {
		return false
	}

	return strings.HasSuffix(host, domain)
}
349854
func (q *IdsQuery) Source() (interface{}, error) {
	// {
	//	"ids" : {
	//		"type" : "my_type",
	//		"values" : ["1", "4", "100"]
	//	}
	// }

	source := make(map[string]interface{})
	query := make(map[string]interface{})
	source["ids"] = query

	// type(s)
	if len(q.types) == 1 {
		query["type"] = q.types[0]
	} else if len(q.types) > 1 {
		query["types"] = q.types
	}

	// values
	query["values"] = q.values

	if q.boost != nil {
		query["boost"] = *q.boost
	}
	if q.queryName != "" {
		query["_name"] = q.queryName
	}

	return source, nil
}
1307950
func (c *CORSConfig) IsValidOrigin(origin string) bool {
	// If we aren't enabling CORS then all origins are valid
	if !c.IsEnabled() {
		return true
	}

	c.RLock()
	defer c.RUnlock()

	if len(c.AllowedOrigins) == 0 {
		return false
	}

	if len(c.AllowedOrigins) == 1 && (c.AllowedOrigins)[0] == "*" {
		return true
	}

	return strutil.StrListContains(c.AllowedOrigins, origin)
}
279236
func (q RawStringQuery) Source() (interface{}, error) {
	var f interface{}
	err := json.Unmarshal([]byte(q), &f)
	return f, err
}
370714
func isAscii(s string) bool {
	for _, c := range s {
		if c > unicode.MaxASCII || unicode.IsControl(c) {
			return false
		}
	}
	return true
}
572376
func IsValidIP(value string) []string {
	if net.ParseIP(value) == nil {
		return []string{"must be a valid IP address, (e.g. 10.9.8.7)"}
	}
	return nil
}
2604
func IsASCII(str string) bool {
	if IsNull(str) {
		return true
	}
	return rxASCII.MatchString(str)
}
477993
func (t *Task) IP(srcs ...string) string {
	if ips := t.IPs(srcs...); len(ips) > 0 {
		return ips[0].String()
	}
	return ""
}
1049447
func (t *IPsTable) ids(c context.Context) map[common.IPv4]int64 {
	ips := make(map[common.IPv4]int64, len(t.current))
	for _, ip := range t.current {
		ips[ip.IPv4] = ip.Id
	}
	return ips
}
25147
func strPtrIsNilOrContentIsEqual(l, r *string) bool {
	if l == nil && r != nil {
		return false
	}
	if l != nil && r == nil {
		return false
	}
	if l == nil && r == nil {
		return true
	}
	return *l == *r
}
63607
func (c *SCSICmd) CheckCondition(key byte, asc uint16) SCSIResponse {
	buf := make([]byte, tcmuSenseBufferSize)
	buf[0] = 0x70 /* fixed, current */
	buf[2] = key
	buf[7] = 0xa
	buf[12] = byte(uint8((asc >> 8) & 0xff))
	buf[13] = byte(uint8(asc & 0xff))
	return SCSIResponse{
		id:          c.id,
		status:      scsi.SamStatCheckCondition,
		senseBuffer: buf,
	}
}
811838
func srcImporter(typesImporter types.Importer, path string) (pkg *types.Package, err error) {
	return typesImporter.Import(path)
}
1286156
func IsCIDR(str string) bool {
	_, _, err := net.ParseCIDR(str)
	return err == nil
}
1345482
func (cniApp *cniAppInfo) sendCniResp(cniResp []byte, retCode int) int {
	cniLog.Infof("sent CNI response: %s ", cniResp)
	fmt.Printf("%s\n", string(cniResp))
	return retCode
}