code: func EndpointFromSshUrl(u *url.URL) Endpoint {
  	var endpoint Endpoint
  	// Pull out port now, we need it separately for SSH
  	regex := regexp.MustCompile(`^([^\:]+)(?:\:(\d+))?$`)
  	match := regex.FindStringSubmatch(u.Host)
  	if match == nil || len(match) < 2 {
  		endpoint.Url = UrlUnknown
  		return endpoint
  	}
  
  	host := match[1]
  	if u.User != nil && u.User.Username() != "" {
  		endpoint.SshUserAndHost = fmt.Sprintf("%s@%s", u.User.Username(), host)
  	} else {
  		endpoint.SshUserAndHost = host
  	}
  
  	if len(match) > 2 {
  		endpoint.SshPort = match[2]
  	}
  
  	// u.Path includes a preceding '/', strip off manually
  	// rooted paths in the URL will be '//path/to/blah'
  	// this is just how Go's URL parsing works
  	if strings.HasPrefix(u.Path, "/") {
  		endpoint.SshPath = u.Path[1:]
  	} else {
  		endpoint.SshPath = u.Path
  	}
  
  	// Fallback URL for using HTTPS while still using SSH for git
  	// u.Host includes host & port so can't use SSH port
  	endpoint.Url = fmt.Sprintf("https://%s%s", host, u.Path)
  
  	return endpoint
  }
docs: // EndpointFromSshUrl constructs a new endpoint from an ssh:// URL