From ba05370fcfa6800f1ac7466bac0bf054720817ea Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:27:15 +0200 Subject: [PATCH] begin working on rpc cli --- main.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 24ef0c4..490b45d 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,6 @@ var isNode bool var isHost bool var isRpc bool var configPath string -var rpcPath string var bootstrap bool var justNodeId bool var daemonize bool @@ -195,6 +194,21 @@ signaling: node.Stop() } +func hostMain() { + +} + +var rpcPath string +var rpcNewHost string +var rpcNewNode string +var rpcQueryHost string +var rpcQueryHostname string +var rpcGetRoutes bool + +func rpcMain() { + +} + func main() { // first, we need to determine who we are: node, host or rpc. // determine by executable name (lux binary will be symlinked to lux-node, lux-host, luc-rpc), @@ -203,11 +217,17 @@ func main() { flag.BoolVar(&isHost, "host", false, "LUX host") flag.BoolVar(&isRpc, "rpc", false, "RPC tool") flag.StringVar(&configPath, "config", "", "node or host config") - flag.StringVar(&rpcPath, "rpc-path", "", "path to RPC UNIX socket or TCP socket, must be in unix:// or tcp:// form") flag.BoolVar(&bootstrap, "bootstrap", false, "bootstrap node keystore. config must be specified") flag.BoolVar(&justNodeId, "just-node-id", false, "when bootstrapping only output node id to stdout") flag.BoolVar(&daemonize, "daemonize", false, "run LUX as daemon in background") flag.StringVar(&pidPath, "pid", "", "after daemonization LUX will write its PID here") + + flag.StringVar(&rpcPath, "rpc-path", "", "path to RPC UNIX socket or TCP socket, must be in unix:// or tcp:// form") + flag.StringVar(&rpcNewHost, "rpc-new-host", "", "RPC node create new host, specifies path for new keystore") + flag.StringVar(&rpcNewNode, "rpc-new-node", "", "RPC node create new node, specifies path for new keystore") + flag.StringVar(&rpcQueryHost, "rpc-query-host", "", "RPC node query host state by ID") + flag.StringVar(&rpcQueryHostname, "rpc-query-hostname", "", "RPC node querty host state by hostname") + flag.BoolVar(&rpcGetRoutes, "rpc-get-routes", false, "RPC node list established routes") flag.Parse() if !isNode && !isHost && !isRpc { @@ -236,5 +256,9 @@ func main() { if isNode { nodeMain() + } else if isHost { + hostMain() + } else if isRpc { + rpcMain() } }