// GetPeerURL creates an HTTPS URL that uses the configured advertise
// address and peer port for the API controller
760608
func GetPeerURL(localEndpoint *kubeadmapi.APIEndpoint) string {
	return "https://" + net.JoinHostPort(localEndpoint.AdvertiseAddress, strconv.Itoa(constants.EtcdListenPeerPort))
}
479131
func (r *RepositoryTag) GetTarballURL() string {
	if r == nil || r.TarballURL == nil {
		return ""
	}
	return *r.TarballURL
}
910172
func (c *Contributor) GetReposURL() string {
	if c == nil || c.ReposURL == nil {
		return ""
	}
	return *c.ReposURL
}
170570
func (s *service) GetPeers() ([]fab.Peer, error) {
	if s.peersRef.IsClosed() {
		return nil, errors.Errorf("Discovery client has been closed")
	}

	refValue, err := s.peersRef.Get()
	if err != nil {
		return nil, err
	}
	peers, ok := refValue.([]fab.Peer)
	if !ok {
		return nil, errors.New("get peersRef didn't return Peer type")
	}
	return peers, nil
}
943883
func (c *FlickrClient) GetUrl() string {
	return fmt.Sprintf("%s?%s", c.EndpointUrl, c.Args.Encode())
}
261157
func (n *NotificationSubject) GetURL() string {
	if n == nil || n.URL == nil {
		return ""
	}
	return *n.URL
}
341247
func (s *Subscription) GetRepositoryURL() string {
	if s == nil || s.RepositoryURL == nil {
		return ""
	}
	return *s.RepositoryURL
}
855774
func (p *ProjectCard) GetURL() string {
	if p == nil || p.URL == nil {
		return ""
	}
	return *p.URL
}
565008
func (pm *PeerManager) getNewAddress() (net.Addr, error) {
	// If we have a trusted peer we'll just return it
	if pm.trustedPeer == nil {
		pm.peerMutex.Lock()
		defer pm.peerMutex.Unlock()
		// We're going to loop here and pull addresses from the addrManager until we get one that we
		// are not currently connect to or haven't recently tried.
	loop:
		for tries := 0; tries < 100; tries++ {
			ka := pm.addrManager.GetAddress()
			if ka == nil {
				continue
			}

			// only allow recent nodes (10mins) after we failed 30
			// times
			if tries < 30 && time.Since(ka.LastAttempt()) < 10*time.Minute {
				continue
			}

			// allow nondefault ports after 50 failed tries.
			if tries < 50 && fmt.Sprintf("%d", ka.NetAddress().Port) != pm.peerConfig.ChainParams.DefaultPort {
				continue
			}

			knownAddress := ka.NetAddress()

			// Don't return addresses we're still connected to
			for _, p := range pm.connectedPeers {
				if p.NA().IP.String() == knownAddress.IP.String() {
					continue loop
				}
			}
			addr := &net.TCPAddr{
				Port: int(knownAddress.Port),
				IP:   knownAddress.IP,
			}
			pm.addrManager.Attempt(knownAddress)
			return addr, nil
		}
		return nil, errors.New("failed to find appropriate address to return")
	} else {
		return pm.trustedPeer, nil
	}
}
402128
func (p *PushEventRepository) GetSSHURL() string {
	if p == nil || p.SSHURL == nil {
		return ""
	}
	return *p.SSHURL
}
163288
func (p *PagesBuild) GetURL() string {
	if p == nil || p.URL == nil {
		return ""
	}
	return *p.URL
}
1344925
func (r *ringDescriber) getClusterPeerInfo() ([]*HostInfo, error) {
	var hosts []*HostInfo
	iter := r.session.control.withConnHost(func(ch *connHost) *Iter {
		hosts = append(hosts, ch.host)
		return ch.conn.query(context.TODO(), "SELECT * FROM system.peers")
	})

	if iter == nil {
		return nil, errNoControl
	}

	rows, err := iter.SliceMap()
	if err != nil {
		// TODO(zariel): make typed error
		return nil, fmt.Errorf("unable to fetch peer host info: %s", err)
	}

	for _, row := range rows {
		// extract all available info about the peer
		host, err := r.session.hostInfoFromMap(row, r.session.cfg.Port)
		if err != nil {
			return nil, err
		} else if !isValidPeer(host) {
			// If it's not a valid peer
			Logger.Printf("Found invalid peer '%s' "+
				"Likely due to a gossip or snitch issue, this host will be ignored", host)
			continue
		}

		hosts = append(hosts, host)
	}

	return hosts, nil
}
1262799
func (p *PullRequest) GetURL() string {
	if p == nil || p.URL == nil {
		return ""
	}
	return *p.URL
}
1374793
func (r *defaultRouter) GetLocalPeer(realmURI URI, details map[string]interface{}) (Peer, error) {
	realm, ok := r.realms[realmURI]
	if !ok {
		return nil, NoSuchRealmError(realmURI)
	}
	// TODO: session open/close callbacks?
	return realm.getPeer(details)
}
1052168
func (r *Repository) GetContentsURL() string {
	if r == nil || r.ContentsURL == nil {
		return ""
	}
	return *r.ContentsURL
}
1113189
func getRemoteIP() (ip string, err error) {
	client := &http.Client{
		Timeout: time.Second * 30,
	}

	req, err := http.NewRequest("GET", "http://ifconfig.me", nil)
	if err != nil {
		return
	}

	req.Header.Set("User-Agent", "curl")
	res, err := client.Do(req)
	if err != nil {
		return
	}

	defer res.Body.Close()

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return
	}
	ip = string(data)

	return
}
503387
func (t *Transport) getOrCreatePeer(pid peer.Identifier) *tchannelPeer {
	addr := pid.Identifier()
	if p, ok := t.peers[addr]; ok {
		return p
	}

	p := newPeer(addr, t)
	t.peers[addr] = p
	// Start a peer connection loop
	t.connectorsGroup.Add(1)
	go p.MaintainConn()

	return p
}