// addr returns the address string for the healthcheck target.
429284
func (t *Target) addr() string {
	if t.IP.To4() != nil {
		return fmt.Sprintf("%v:%d", t.IP, t.Port)
	}
	return fmt.Sprintf("[%v]:%d", t.IP, t.Port)
}
1030739
func (listener *httpListener) Addrs() (addrs []net.Addr) {
	for i := range listener.tcpListeners {
		addrs = append(addrs, listener.tcpListeners[i].Addr())
	}

	return addrs
}
562580
func (s *Server) Address() (string, error) {
	s.serverLock.RLock()
	defer s.serverLock.RUnlock()
	return s.server.Addr()
}
981455
func parseAddr(address string) (net.Addr, error) {
	var (
		host string
		port int
	)

	// Split the address into its host and port components.
	h, p, err := net.SplitHostPort(address)
	if err != nil {
		// If a port wasn't specified, we'll assume the address only
		// contains the host so we'll use the default port.
		host = address
		port = defaultPeerPort
	} else {
		// Otherwise, we'll note both the host and ports.
		host = h
		portNum, err := strconv.Atoi(p)
		if err != nil {
			return nil, err
		}
		port = portNum
	}

	if tor.IsOnionHost(host) {
		return &tor.OnionAddr{OnionService: host, Port: port}, nil
	}

	// If the host is part of a TCP address, we'll use the network
	// specific ResolveTCPAddr function in order to resolve these
	// addresses over Tor in order to prevent leaking your real IP
	// address.
	hostPort := net.JoinHostPort(host, strconv.Itoa(port))
	return cfg.net.ResolveTCPAddr("tcp", hostPort)
}
906834
func (r *Renderer) Healthcheck() (string, error) {
	resp, err := r.client.Get(r.url + "/healthcheck")
	if err != nil {
		return service, err
	}

	if resp.StatusCode != http.StatusOK {
		return service, ErrInvalidRendererResponse{resp.StatusCode}
	}

	return service, nil
}
152388
func (listener *Listener) Addr() net.Addr {
	if listener.psocket != nil {
		return listener.psocket.Addr()
	}
	return listener.udpsocket.LocalAddr()
}
606415
func (u *ID) Addr() (updateAddr storage.Address) {
	serializedData := make([]byte, idLength)
	var cursor int
	u.Feed.binaryPut(serializedData[cursor : cursor+feedLength])
	cursor += feedLength

	eid := u.Epoch.ID()
	copy(serializedData[cursor:cursor+lookup.EpochLength], eid[:])

	hasher := hashPool.Get().(hash.Hash)
	defer hashPool.Put(hasher)
	hasher.Reset()
	hasher.Write(serializedData)
	return hasher.Sum(nil)
}
1067421
func (r *Resource) Addr() addrs.Resource {
	return addrs.Resource{
		Mode: r.Mode,
		Type: r.Type,
		Name: r.Name,
	}
}
1092643
func (neo4j *HealthCheckClient) Healthcheck() (string, error) {

	logData := log.Data{"statement": pingStmt}
	conn, err := neo4j.dbPool.OpenPool()
	if err != nil {
		log.ErrorC("neo4j healthcheck open pool", err, logData)
		return neo4j.serviceName, err
	}
	defer conn.Close()

	rows, err := conn.QueryNeo(pingStmt, nil)
	if err != nil {
		log.ErrorC("neo4j healthcheck query", err, logData)
		return neo4j.serviceName, err
	}
	defer rows.Close()

	return neo4j.serviceName, nil
}
434163
func NewHealthCheck() http.Handler {
	return api.HTTPHandler{
		Handler: api.HandlerFunc(healthHandler),
		Methods: []string{"GET"},
	}
}
800988
func HostnameFromAddr(addr string) (string, error) {
	p, err := url.Parse(addr)
	if err != nil {
		return "", err
	}
	h := p.Host

	// copied from https://golang.org/src/net/http/transport.go
	if hasPort(h) {
		h = h[:strings.LastIndex(h, ":")]
	}

	return h, nil
}
1098934
func (h *Hostsfile) LookupStaticAddr(addr string) []string {
	h.RLock()
	defer h.RUnlock()
	addr = parseLiteralIP(addr).String()
	if addr == "" {
		return nil
	}
	if len(h.hmap.byAddr) != 0 {
		if hosts, ok := h.hmap.byAddr[addr]; ok {
			hostsCp := make([]string, len(hosts))
			copy(hostsCp, hosts)
			return hostsCp
		}
	}
	return nil
}
1076323
func (n *ExecNode) Addr() []byte {
	if n.Info == nil {
		return nil
	}
	return []byte(n.Info.Enode)
}
853361
func LookupPTR(addr string, server string, c *dns.Client, m *dns.Msg) (name []string, err error) {

	reverse, err := dns.ReverseAddr(addr)
	if err != nil {
		return nil, err
	}

	m.SetQuestion(reverse, dns.TypePTR)

	r, _, err := c.Exchange(m, net.JoinHostPort(server, "53"))
	if err != nil {
		return nil, err
	}

	for _, ans := range r.Answer {
		name = append(name, ans.(*dns.PTR).Ptr)
	}

	return
}
362060
func (n *healthNode) HealthIP() string {
	if n.NodeElement.HealthEndpointAddress == nil {
		return ""
	}
	if n.NodeElement.HealthEndpointAddress.IPV4.Enabled {
		return n.NodeElement.HealthEndpointAddress.IPV4.IP
	}
	return n.NodeElement.HealthEndpointAddress.IPV6.IP
}
552574
func (oas *ObservedAddrSet) Addrs() (addrs []ma.Multiaddr) {
	oas.RLock()
	defer oas.RUnlock()

	if len(oas.addrs) == 0 {
		return nil
	}

	now := time.Now()
	for _, observedAddrs := range oas.addrs {
		for _, a := range observedAddrs {
			if now.Sub(a.LastSeen) <= oas.ttl && a.activated(oas.ttl) {
				addrs = append(addrs, a.Addr)
			}
		}
	}
	return addrs
}
130084
func (i *Inbound) Addr() net.Addr {
	if i.server == nil {
		return nil
	}

	listener := i.server.Listener()
	if listener == nil {
		return nil
	}

	return listener.Addr()
}