Integrate duplicated logic to construct SSH URL