begin working on rpc cli

This commit is contained in:
mykola2312 2025-01-24 19:27:15 +02:00
parent 510bfb0e27
commit ba05370fcf

28
main.go
View file

@ -18,7 +18,6 @@ var isNode bool
var isHost bool var isHost bool
var isRpc bool var isRpc bool
var configPath string var configPath string
var rpcPath string
var bootstrap bool var bootstrap bool
var justNodeId bool var justNodeId bool
var daemonize bool var daemonize bool
@ -195,6 +194,21 @@ signaling:
node.Stop() 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() { func main() {
// first, we need to determine who we are: node, host or rpc. // 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), // 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(&isHost, "host", false, "LUX host")
flag.BoolVar(&isRpc, "rpc", false, "RPC tool") flag.BoolVar(&isRpc, "rpc", false, "RPC tool")
flag.StringVar(&configPath, "config", "", "node or host config") 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(&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(&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.BoolVar(&daemonize, "daemonize", false, "run LUX as daemon in background")
flag.StringVar(&pidPath, "pid", "", "after daemonization LUX will write its PID here") 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() flag.Parse()
if !isNode && !isHost && !isRpc { if !isNode && !isHost && !isRpc {
@ -236,5 +256,9 @@ func main() {
if isNode { if isNode {
nodeMain() nodeMain()
} else if isHost {
hostMain()
} else if isRpc {
rpcMain()
} }
} }