code: func LoopbackHostPort(bindAddress string) (string, string, error) {
  	host, port, err := net.SplitHostPort(bindAddress)
  	if err != nil {
  		// should never happen
  		return "", "", fmt.Errorf("invalid server bind address: %q", bindAddress)
  	}
  
  	isIPv6 := net.ParseIP(host).To4() == nil
  
  	// Value is expected to be an IP or DNS name, not "0.0.0.0".
  	if host == "0.0.0.0" || host == "::" {
  		host = "localhost"
  		// Get ip of local interface, but fall back to "localhost".
  		// Note that "localhost" is resolved with the external nameserver first with Go's stdlib.
  		// So if localhost.<yoursearchdomain> resolves, we don't get a 127.0.0.1 as expected.
  		addrs, err := net.InterfaceAddrs()
  		if err == nil {
  			for _, address := range addrs {
  				if ipnet, ok := address.(*net.IPNet); ok && ipnet.IP.IsLoopback() && isIPv6 == (ipnet.IP.To4() == nil) {
  					host = ipnet.IP.String()
  					break
  				}
  			}
  		}
  	}
  	return host, port, nil
  }
docs: // LoopbackHostPort returns the host and port loopback REST clients should use
  // to contact the server.