// GetStoreAddr returns a tikv server's address by its storeID. It checks cache
// first, sends request to pd server when necessary.
760132
func (c *RegionCache) GetStoreAddr(bo *Backoffer, id uint64) (string, error) {
	c.storeMu.RLock()
	if store, ok := c.storeMu.stores[id]; ok {
		c.storeMu.RUnlock()
		return store.Addr, nil
	}
	c.storeMu.RUnlock()
	return c.ReloadStoreAddr(bo, id)
}
361064
func (r Network_Storage_MassDataMigration_Request) GetAddress() (resp datatypes.Account_Address, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Storage_MassDataMigration_Request", "getAddress", nil, &r.Options, &resp)
	return
}
521760
func (c *Conn) LocalAddr() (net.Addr, error) {
	if !c.IsAlive() {
		return nil, errors.New("connection not ready")
	}
	return c.conn.LocalAddr(), nil
}
951530
func (sl *ServerLookup) ServerAddr(id raft.ServerID) (raft.ServerAddress, error) {
	sl.lock.RLock()
	defer sl.lock.RUnlock()
	svr, ok := sl.idToServer[id]
	if !ok {
		return "", fmt.Errorf("Could not find address for server id %v", id)
	}
	return raft.ServerAddress(svr.Addr.String()), nil
}
564927
func (n *NodeStore) Get(key []byte) (data []byte, err error) {
	return n.store.Get(n.addr, key)
}
665613
func (c *Cluster) UpdateStoreAddr(storeID uint64, addr string) {
	c.Lock()
	defer c.Unlock()
	c.stores[storeID] = newStore(storeID, addr)
}
1108468
func lookupTargetDNSServer(w dns.ResponseWriter) (server string, err error) {
	return w.LocalAddr().String(), nil
}
1217254
func (c *Cluster) GetAdvertiseAddress() string {
	c.mu.RLock()
	defer c.mu.RUnlock()
	if c.nr != nil && c.nr.config.AdvertiseAddr != "" {
		advertiseHost, _, _ := net.SplitHostPort(c.nr.config.AdvertiseAddr)
		return advertiseHost
	}
	return c.currentNodeState().actualLocalAddr
}
982761
func (brs *BranchRecoveryState) GetAddr(index uint32) btcutil.Address {
	return brs.addresses[index]
}
271221
func GetIPAddress() (ip string, err error) {
	ip, err = getIPAddrFromOutGoingConnection()
	switch {
	case err != nil:
		return "", err
	case err == nil && strings.HasPrefix(ip, "127"):
		return "", fmt.Errorf("unable to identify local ip address")
	default:
		return ip, err
	}
}
1036720
func getAddr(addr string) (string, error) {
	if strings.Compare(addr, "0.0.0.0") == 0 {
		addrs, err := net.InterfaceAddrs()
		if err != nil {
			return "", err
		}
		for _, address := range addrs {
			// check the address type and if it is not a loopback the display it
			if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
				if ipnet.IP.To4() != nil {
					return ipnet.IP.String(), nil
				}
			}
		}
	}
	return addr, nil
}
278687
func GetDomain(store kv.Storage) (*domain.Domain, error) {
	return domap.Get(store)
}
1364184
func (e *Etcd) Get() (*api.RangeAllocation, error) {
	existing := &api.RangeAllocation{}
	if err := e.storage.Get(context.TODO(), e.baseKey, "", existing, true); err != nil {
		return nil, storeerr.InterpretGetError(err, e.resource, "")
	}
	return existing, nil
}
80350
func (mg *MailgunImpl) GetStoredAttachment(ctx context.Context, url string) ([]byte, error) {
	r := newHTTPRequest(url)
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	r.addHeader("Accept", "message/rfc2822")

	response, err := makeGetRequest(ctx, r)

	return response.Data, err
}
680341
func (rt *routingTable) GetNodeByAddress(address string) (no *node, ok bool) {
	rt.RLock()
	defer rt.RUnlock()

	v, ok := rt.cachedNodes.Get(address)
	if ok {
		no = v.(*node)
	}
	return
}
966338
func (s *CacheService) Get(base string) *RatesStore {
	// Is our cache expired?
	if s.IsExpired(base) {
		return nil
	}

	// Use stored results.
	return cache[base]
}
607795
func GetEtcdProbeAddress(cfg *kubeadmapi.Etcd) string {
	if cfg.Local != nil && cfg.Local.ExtraArgs != nil {
		if arg, exists := cfg.Local.ExtraArgs[etcdListenClientURLsArg]; exists {
			// Use the first url in the listen-client-urls if multiple url's are specified.
			if strings.ContainsAny(arg, ",") {
				arg = strings.Split(arg, ",")[0]
			}
			parsedURL, err := url.Parse(arg)
			if err != nil || parsedURL.Hostname() == "" {
				return "127.0.0.1"
			}
			// Return the IP if the URL contains an address instead of a name.
			if ip := net.ParseIP(parsedURL.Hostname()); ip != nil {
				// etcdctl doesn't support auto-converting zero addresses into loopback addresses
				if ip.Equal(net.IPv4zero) {
					return "127.0.0.1"
				}
				if ip.Equal(net.IPv6zero) {
					return net.IPv6loopback.String()
				}
				return ip.String()
			}
			// Use the local resolver to try resolving the name within the URL.
			// If the name can not be resolved, return an IPv4 loopback address.
			// Otherwise, select the first valid IPv4 address.
			// If the name does not resolve to an IPv4 address, select the first valid IPv6 address.
			addrs, err := net.LookupIP(parsedURL.Hostname())
			if err != nil {
				return "127.0.0.1"
			}
			var ip net.IP
			for _, addr := range addrs {
				if addr.To4() != nil {
					ip = addr
					break
				}
				if addr.To16() != nil && ip == nil {
					ip = addr
				}
			}
			return ip.String()
		}
	}
	return "127.0.0.1"
}