code: func parseSwarm(hostURL string, h *host.Host) (string, error) {
  	swarmOptions := h.HostOptions.SwarmOptions
  
  	if !swarmOptions.Master {
  		return "", fmt.Errorf("%q is not a swarm master. The --swarm flag is intended for use with swarm masters", h.Name)
  	}
  
  	u, err := url.Parse(swarmOptions.Host)
  	if err != nil {
  		return "", fmt.Errorf("There was an error parsing the url: %s", err)
  	}
  	parts := strings.Split(u.Host, ":")
  	swarmPort := parts[1]
  
  	// get IP of machine to replace in case swarm host is 0.0.0.0
  	mURL, err := url.Parse(hostURL)
  	if err != nil {
  		return "", fmt.Errorf("There was an error parsing the url: %s", err)
  	}
  
  	mParts := strings.Split(mURL.Host, ":")
  	machineIP := mParts[0]
  
  	hostURL = fmt.Sprintf("tcp://%s:%s", machineIP, swarmPort)
  
  	return hostURL, nil
  }
docs: // TODO: This could use a unit test.