2022-11-26 15:57:11 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2023-01-11 15:58:49 +00:00
|
|
|
cli "github.com/urfave/cli/v2"
|
|
|
|
"github.com/urfave/cli/v2/altsrc"
|
2023-08-09 18:14:54 +00:00
|
|
|
"github.com/waku-org/go-waku/cmd/waku/keygen"
|
2022-11-26 15:57:11 +00:00
|
|
|
"github.com/waku-org/go-waku/waku/v2/node"
|
|
|
|
)
|
|
|
|
|
2023-08-09 18:14:54 +00:00
|
|
|
var options NodeOptions
|
2022-11-26 15:57:11 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Defaults
|
|
|
|
options.LogLevel = "INFO"
|
|
|
|
options.LogEncoding = "console"
|
|
|
|
|
|
|
|
cliFlags := []cli.Flag{
|
2023-01-11 15:58:49 +00:00
|
|
|
&cli.StringFlag{Name: "config-file", Usage: "loads configuration from a TOML file (cmd-line parameters take precedence)"},
|
2022-12-06 17:14:05 +00:00
|
|
|
TcpPort,
|
|
|
|
Address,
|
2023-08-03 16:21:15 +00:00
|
|
|
MaxPeerConnections,
|
2022-12-06 17:14:05 +00:00
|
|
|
WebsocketSupport,
|
|
|
|
WebsocketPort,
|
|
|
|
WebsocketSecurePort,
|
|
|
|
WebsocketAddress,
|
|
|
|
WebsocketSecureSupport,
|
|
|
|
WebsocketSecureKeyPath,
|
|
|
|
WebsocketSecureCertPath,
|
2023-07-06 21:40:57 +00:00
|
|
|
DNS4DomainName,
|
2022-12-06 17:14:05 +00:00
|
|
|
NodeKey,
|
|
|
|
KeyFile,
|
|
|
|
KeyPassword,
|
|
|
|
StaticNode,
|
|
|
|
KeepAlive,
|
|
|
|
PersistPeers,
|
|
|
|
NAT,
|
2023-05-08 15:19:44 +00:00
|
|
|
IPAddress,
|
|
|
|
ExtMultiaddresses,
|
2022-12-06 17:14:05 +00:00
|
|
|
ShowAddresses,
|
2023-05-12 21:52:42 +00:00
|
|
|
CircuitRelay,
|
2023-05-24 15:34:35 +00:00
|
|
|
ResourceScalingMemoryPercent,
|
|
|
|
ResourceScalingFDPercent,
|
2022-12-06 17:14:05 +00:00
|
|
|
LogLevel,
|
|
|
|
LogEncoding,
|
|
|
|
LogOutput,
|
|
|
|
AgentString,
|
|
|
|
Relay,
|
|
|
|
Topics,
|
2023-05-02 15:10:45 +00:00
|
|
|
ProtectedTopics,
|
2022-12-06 17:14:05 +00:00
|
|
|
RelayPeerExchange,
|
|
|
|
MinRelayPeersToPublish,
|
|
|
|
StoreNodeFlag,
|
|
|
|
StoreFlag,
|
2022-12-09 19:26:24 +00:00
|
|
|
StoreMessageDBURL,
|
2022-12-06 17:14:05 +00:00
|
|
|
StoreMessageRetentionTime,
|
|
|
|
StoreMessageRetentionCapacity,
|
2023-08-08 15:46:32 +00:00
|
|
|
StoreMessageDBVacuum,
|
|
|
|
StoreMessageDBMigration,
|
2022-12-06 17:14:05 +00:00
|
|
|
StoreResumePeer,
|
|
|
|
FilterFlag,
|
|
|
|
FilterNode,
|
|
|
|
FilterTimeout,
|
2023-04-26 13:42:17 +00:00
|
|
|
FilterLegacyFlag,
|
|
|
|
FilterLegacyNode,
|
|
|
|
FilterLegacyLightClient,
|
2022-12-06 17:14:05 +00:00
|
|
|
LightPush,
|
|
|
|
LightPushNode,
|
|
|
|
Discv5Discovery,
|
|
|
|
Discv5BootstrapNode,
|
|
|
|
Discv5UDPPort,
|
|
|
|
Discv5ENRAutoUpdate,
|
|
|
|
PeerExchange,
|
|
|
|
PeerExchangeNode,
|
|
|
|
DNSDiscovery,
|
|
|
|
DNSDiscoveryUrl,
|
|
|
|
DNSDiscoveryNameServer,
|
2023-03-09 15:48:25 +00:00
|
|
|
Rendezvous,
|
|
|
|
RendezvousNode,
|
2023-03-09 22:42:50 +00:00
|
|
|
RendezvousServer,
|
2022-12-06 17:14:05 +00:00
|
|
|
MetricsServer,
|
|
|
|
MetricsServerAddress,
|
|
|
|
MetricsServerPort,
|
|
|
|
RPCFlag,
|
|
|
|
RPCPort,
|
|
|
|
RPCAddress,
|
|
|
|
RPCRelayCacheCapacity,
|
|
|
|
RPCAdmin,
|
|
|
|
RESTFlag,
|
|
|
|
RESTAddress,
|
|
|
|
RESTPort,
|
|
|
|
RESTRelayCacheCapacity,
|
|
|
|
RESTAdmin,
|
2022-12-11 00:08:25 +00:00
|
|
|
PProf,
|
2022-11-26 15:57:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rlnFlags := rlnFlags()
|
|
|
|
cliFlags = append(cliFlags, rlnFlags...)
|
|
|
|
|
|
|
|
cli.VersionFlag = &cli.BoolFlag{
|
|
|
|
Name: "version",
|
|
|
|
Usage: "prints the version",
|
|
|
|
}
|
|
|
|
|
|
|
|
app := &cli.App{
|
|
|
|
Name: "gowaku",
|
|
|
|
Version: node.GetVersionInfo().String(),
|
2023-01-11 15:58:49 +00:00
|
|
|
Before: altsrc.InitInputSourceWithContext(cliFlags, altsrc.NewTomlSourceFromFlagFunc("config-file")),
|
2022-11-26 15:57:11 +00:00
|
|
|
Flags: cliFlags,
|
|
|
|
Action: func(c *cli.Context) error {
|
2023-07-06 21:40:57 +00:00
|
|
|
Execute(options)
|
2022-11-26 15:57:11 +00:00
|
|
|
return nil
|
|
|
|
},
|
2023-08-09 18:14:54 +00:00
|
|
|
Commands: []*cli.Command{
|
|
|
|
&keygen.Command,
|
|
|
|
},
|
2022-11-26 15:57:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|