// ExtractAroundLatLngViaIP returns the first found AroundLatLngViaIPOption from the
// given variadic arguments or nil otherwise.
509302
func ExtractAroundLatLngViaIP(opts ...interface{}) *opt.AroundLatLngViaIPOption {
	for _, o := range opts {
		if v, ok := o.(*opt.AroundLatLngViaIPOption); ok {
			return v
		}
	}
	return nil
}
459009
func getSlow() int64 {
	var buf [64]byte
	return ExtractGID(buf[:runtime.Stack(buf[:], false)])
}
169108
func IsProxyableIP(ip string) error {
	netIP := net.ParseIP(ip)
	if netIP == nil {
		return ErrAddressNotAllowed
	}
	return isProxyableIP(netIP)
}
941641
func (_m *ClientInterface) RemoveVirtualIP(requestVirtualIP pool.VirtualIP) error {
	ret := _m.Called(requestVirtualIP)

	var r0 error
	if rf, ok := ret.Get(0).(func(pool.VirtualIP) error); ok {
		r0 = rf(requestVirtualIP)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
435417
func ExcludeIP(dhcpHandler *DHCPHandler, ipRange string) []net.IP {
	excludeIPs, _ := IPsFromRange(ipRange)

	for _, excludeIP := range excludeIPs {
		if excludeIP != nil {
			// Calculate the position for the dhcp pool
			position := uint32(binary.BigEndian.Uint32(excludeIP.To4())) - uint32(binary.BigEndian.Uint32(dhcpHandler.start.To4()))

			dhcpHandler.available.ReserveIPIndex(uint64(position), FakeMac)
		}
	}
	return excludeIPs
}
567282
func (d *driverMock) GetInstanceIP(ctx context.Context, id string) (string, error) {
	if d.GetInstanceIPErr != nil {
		return "", d.GetInstanceIPErr
	}
	if d.cfg.UsePrivateIP {
		return "private_ip", nil
	}
	return "ip", nil
}
1011463
func extractIptablesVersion(str string) (int, int, int, error) {
	versionMatcher := regexp.MustCompile("v([0-9]+)\\.([0-9]+)\\.([0-9]+)")
	result := versionMatcher.FindStringSubmatch(str)
	if result == nil {
		return 0, 0, 0, fmt.Errorf("no iptables version found in string: %s", str)
	}

	v1, err := strconv.Atoi(result[1])
	if err != nil {
		return 0, 0, 0, err
	}

	v2, err := strconv.Atoi(result[2])
	if err != nil {
		return 0, 0, 0, err
	}

	v3, err := strconv.Atoi(result[3])
	if err != nil {
		return 0, 0, 0, err
	}

	return v1, v2, v3, nil
}
1077372
func extractRetainKeysPatchStrategy(strategies []string) (bool, string, error) {
	switch len(strategies) {
	case 0:
		return false, "", nil
	case 1:
		singleStrategy := strategies[0]
		switch singleStrategy {
		case retainKeysStrategy:
			return true, "", nil
		default:
			return false, singleStrategy, nil
		}
	case 2:
		switch {
		case strategies[0] == retainKeysStrategy:
			return true, strategies[1], nil
		case strategies[1] == retainKeysStrategy:
			return true, strategies[0], nil
		default:
			return false, "", fmt.Errorf("unexpected patch strategy: %v", strategies)
		}
	default:
		return false, "", fmt.Errorf("unexpected patch strategy: %v", strategies)
	}
}
1267121
func (s *VPNService) GetVpnCustomerGatewayID(keyword string, opts ...OptionFunc) (string, int, error) {
	p := &ListVpnCustomerGatewaysParams{}
	p.p = make(map[string]interface{})

	p.p["keyword"] = keyword

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return "", -1, err
		}
	}

	l, err := s.ListVpnCustomerGateways(p)
	if err != nil {
		return "", -1, err
	}

	if l.Count == 0 {
		return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l)
	}

	if l.Count == 1 {
		return l.VpnCustomerGateways[0].Id, l.Count, nil
	}

	if l.Count > 1 {
		for _, v := range l.VpnCustomerGateways {
			if v.Name == keyword {
				return v.Id, l.Count, nil
			}
		}
	}
	return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l)
}
828904
func ExtractInsideBoundingBox(opts ...interface{}) *opt.InsideBoundingBoxOption {
	for _, o := range opts {
		if v, ok := o.(*opt.InsideBoundingBoxOption); ok {
			return v
		}
	}
	return nil
}
1024638
func RealIP(req *http.Request) string {
	ip, ok := req.Context().Value(realIPKey).(string)
	if !ok {
		// Fallback to a secure resolver.
		return DefaultResolver.RealIP(req)
	}
	return ip
}
58526
func (cl *cloudLaunch) findIP() string {
	// Try to find it by name.
	aggAddrList, err := cl.computeService.Addresses.AggregatedList(cl.GCEProjectID).Do()
	if err != nil {
		log.Fatal(err)
	}
	// https://godoc.org/google.golang.org/api/compute/v1#AddressAggregatedList
	var ip string
IPLoop:
	for _, asl := range aggAddrList.Items {
		for _, addr := range asl.Addresses {
			log.Printf("  addr: %#v", addr)
			if addr.Name == cl.Name+"-ip" && addr.Status == "RESERVED" && zoneInRegion(cl.zone(), addr.Region) {
				ip = addr.Address
				break IPLoop
			}
		}
	}
	return ip
}
606119
func (s *ServiceCache) findIP(ip net.IP, port int, local bool) interface{} {

	prefixes := s.remote
	if local {
		prefixes = s.local
	}

	if ip == nil {
		return nil
	}

	for len, prefix := range prefixes {

		binPrefix := binary.BigEndian.Uint32(ip.To4()) & binary.BigEndian.Uint32(net.CIDRMask(len, 32))
		entries, ok := prefix[binPrefix]
		if !ok {
			continue
		}

		for _, e := range entries {
			if e.ports.IsIncluded(port) {
				return e.data
			}
		}
	}
	return nil
}
210564
func ExtractFacetingAfterDistinct(opts ...interface{}) *opt.FacetingAfterDistinctOption {
	for _, o := range opts {
		if v, ok := o.(*opt.FacetingAfterDistinctOption); ok {
			return v
		}
	}
	return nil
}
377838
func (eit *EgressIPTracker) findEgressIPAllocation(ip net.IP, allocation map[string][]string) (string, bool) {
	bestNode := ""
	otherNodes := false

	for _, node := range eit.nodes {
		if node.offline {
			continue
		}
		egressIPs := allocation[node.nodeName]
		for _, parsed := range node.parsedCIDRs {
			if parsed.Contains(ip) {
				if bestNode != "" {
					otherNodes = true
					if len(allocation[bestNode]) < len(egressIPs) {
						break
					}
				}
				bestNode = node.nodeName
				break
			}
		}
	}

	return bestNode, otherNodes
}
803654
func ExtractAroundPrecision(opts ...interface{}) *opt.AroundPrecisionOption {
	for _, o := range opts {
		if v, ok := o.(*opt.AroundPrecisionOption); ok {
			return v
		}
	}
	return nil
}
1229809
func ExtractMinimumAroundRadius(opts ...interface{}) *opt.MinimumAroundRadiusOption {
	for _, o := range opts {
		if v, ok := o.(*opt.MinimumAroundRadiusOption); ok {
			return v
		}
	}
	return nil
}