diff --git a/internal/cmd/server/ssh.go b/internal/cmd/server/ssh.go index 6493fdd2..e40d7580 100644 --- a/internal/cmd/server/ssh.go +++ b/internal/cmd/server/ssh.go @@ -45,17 +45,13 @@ func runSSH(cli *state.State, cmd *cobra.Command, args []string) error { port, _ := cmd.Flags().GetInt("port") ipAddress := server.PublicNet.IPv4.IP - if useIPv6 { + if server.PublicNet.IPv4.IsUnspecified() || useIPv6 { if server.PublicNet.IPv6.IsUnspecified() { - return fmt.Errorf("server %s does not have a assigned primary ipv6", idOrName) + return fmt.Errorf("server %s does not have a assigned primary ipv4 or ipv6", idOrName) } ipAddress = server.PublicNet.IPv6.Network.IP // increment last byte to get the ::1 IP, which is routed ipAddress[15]++ - } else { - if server.PublicNet.IPv4.IsUnspecified() { - return fmt.Errorf("server %s does not have a assigned primary ipv4", idOrName) - } } sshArgs := []string{"-l", user, "-p", strconv.Itoa(port), ipAddress.String()}