small pixel drawing of a pufferfish cascade

minor reorganization
Jes Olson j3s@c3f.net
Mon, 20 Feb 2023 00:47:02 -0800
commit

1f4fa73e815928c247d691f720e823cba5792cc4

parent

f60e57c91cb00a91004bd482ba764b2bede78352

2 files changed, 18 insertions(+), 16 deletions(-)

jump to
M agent/config.goagent/config.go

@@ -17,10 +17,10 @@ panic(err)

} return &Config{ - BindAddr: "0.0.0.0", - LogLevel: "INFO", - NodeName: hostname, - RpcAddr: "127.0.0.1:4441", + BindAddr: "0.0.0.0", + ClientAddr: "0.0.0.0", + LogLevel: "INFO", + NodeName: hostname, } }

@@ -33,12 +33,12 @@ port int

} type Config struct { - BindAddr string - LogLevel string - NodeName string - RpcAddr string - StartJoin []string - Services []Service + BindAddr string + ClientAddr string + LogLevel string + NodeName string + StartJoin []string + Services []Service } // lifted from serf, could be simplified
M main.gomain.go

@@ -9,7 +9,7 @@ "git.j3s.sh/cascade/list"

) // TODO: rename agent to something cooler -const help = `cascade agent start a cascade agent +const usage = `cascade agent start a cascade agent cascade list|ls list nodes or services cascade members show serf cluster members cascade rtt estimate latency between nodes

@@ -17,19 +17,21 @@ `

func main() { if len(os.Args) == 1 { - fmt.Fprintf(os.Stderr, "%s", help) + fmt.Fprintf(os.Stderr, "%s", usage) os.Exit(1) } - cmd := os.Args[1] - args := os.Args[2:] - switch cmd { + run(os.Args[1], os.Args[2:]) +} + +func run(command string, args []string) { + switch command { case "agent": agent.Run() case "list", "ls": list.Run(args) default: - fmt.Fprintf(os.Stderr, "'%s' is not a valid command\n\n%s", cmd, help) + fmt.Fprintf(os.Stderr, "'%s' is not a valid command\n\n%s", command, usage) os.Exit(1) } }