enable master election

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2019-10-06 22:10:29 -04:00
parent bde4dba555
commit 9b07492180
No known key found for this signature in database
GPG key ID: A519480096146526
8 changed files with 112 additions and 63 deletions

View file

@ -26,6 +26,7 @@ import (
"os"
"text/tabwriter"
humanize "github.com/dustin/go-humanize"
"github.com/urfave/cli"
)
@ -53,10 +54,10 @@ var listNodesCommand = cli.Command{
}
w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
fmt.Fprintf(w, "ID\tADDR\tENDPOINT\tGATEWAY\tPUBLIC KEY\n")
fmt.Fprintf(w, "ID\tADDR\tENDPOINT\tGATEWAY\tUPDATED\tPUBLIC KEY\n")
for _, n := range nodes {
ep := fmt.Sprintf("%s:%d", n.EndpointIP, n.EndpointPort)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", n.ID, n.Addr, ep, n.GatewayIP, n.KeyPair.PublicKey)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n", n.ID, n.Addr, ep, n.GatewayIP, humanize.Time(n.Updated), n.KeyPair.PublicKey)
}
w.Flush()