summaryrefslogtreecommitdiff
path: root/digitalocean/droplet.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-12-31 09:52:23 -0600
committerJeff Carr <[email protected]>2023-12-31 09:52:23 -0600
commit519e428e2f5e10d31cce39dd9b98428479d5c994 (patch)
treec0de72dc85a960ab22191f5a1e4276d042dc5c6b /digitalocean/droplet.go
parente4a04f36f0fc0c6d6ec9c2674f5020473fc19013 (diff)
launch xterm
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'digitalocean/droplet.go')
-rw-r--r--digitalocean/droplet.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/digitalocean/droplet.go b/digitalocean/droplet.go
index 8da6e97..a780a13 100644
--- a/digitalocean/droplet.go
+++ b/digitalocean/droplet.go
@@ -99,6 +99,16 @@ func (d *Droplet) On() bool {
func (d *Droplet) HasIPv4() bool {
if ! d.Ready() {return false}
+ if d.ipv4.GetText() == "" {
+ return false
+ }
+ return true
+}
+func (d *Droplet) HasIPv6() bool {
+ if ! d.Ready() {return false}
+ if d.ipv6.GetText() == "" {
+ return false
+ }
return true
}
@@ -118,6 +128,14 @@ func (d *Droplet) Connect() {
if d.HasIPv4() {
ipv4 := d.GetIPv4()
log.Info("droplet has IPv4 =", ipv4)
+ xterm("ssh root@" + ipv4)
+ return
+ }
+ if d.HasIPv6() {
+ ipv6 := d.GetIPv6()
+ log.Info("droplet has IPv6 =", ipv6)
+ xterm("ssh root@[" + ipv6 + "]")
+ return
}
log.Info("droplet.Connect() here", d.GetIPv4(), d.GetIPv6())
}