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"
|
2022-11-26 15:57:11 +00:00
|
|
|
"github.com/waku-org/go-waku/waku"
|
|
|
|
"github.com/waku-org/go-waku/waku/v2/node"
|
|
|
|
)
|
|
|
|
|
|
|
|
var options waku.Options
|
|
|
|
|
|
|
|
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,
|
|
|
|
WebsocketSupport,
|
|
|
|
WebsocketPort,
|
|
|
|
WebsocketSecurePort,
|
|
|
|
WebsocketAddress,
|
|
|
|
WebsocketSecureSupport,
|
|
|
|
WebsocketSecureKeyPath,
|
|
|
|
WebsocketSecureCertPath,
|
|
|
|
Dns4DomainName,
|
|
|
|
NodeKey,
|
|
|
|
KeyFile,
|
|
|
|
KeyPassword,
|
|
|
|
GenerateKey,
|
|
|
|
Overwrite,
|
|
|
|
StaticNode,
|
|
|
|
KeepAlive,
|
|
|
|
PersistPeers,
|
|
|
|
NAT,
|
|
|
|
AdvertiseAddress,
|
|
|
|
ShowAddresses,
|
|
|
|
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,
|
|
|
|
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,
|
|
|
|
RPCPrivate,
|
|
|
|
RESTFlag,
|
|
|
|
RESTAddress,
|
|
|
|
RESTPort,
|
|
|
|
RESTRelayCacheCapacity,
|
|
|
|
RESTAdmin,
|
|
|
|
RESTPrivate,
|
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 {
|
|
|
|
waku.Execute(options)
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|