2021-03-18 23:21:45 +00:00
|
|
|
package main
|
|
|
|
|
2021-03-22 16:45:13 +00:00
|
|
|
import (
|
2021-10-03 21:45:07 +00:00
|
|
|
"os"
|
2022-08-15 17:13:45 +00:00
|
|
|
"time"
|
2021-10-03 21:45:07 +00:00
|
|
|
|
2022-11-02 10:39:13 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
2022-02-21 15:23:52 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2022-11-09 19:53:01 +00:00
|
|
|
"github.com/waku-org/go-waku/waku"
|
|
|
|
"github.com/waku-org/go-waku/waku/cliutils"
|
|
|
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
2021-03-22 16:45:13 +00:00
|
|
|
)
|
2021-03-18 23:21:45 +00:00
|
|
|
|
2021-10-03 21:45:07 +00:00
|
|
|
var options waku.Options
|
|
|
|
|
2021-03-18 23:21:45 +00:00
|
|
|
func main() {
|
2022-08-15 17:13:45 +00:00
|
|
|
// Defaults
|
|
|
|
options.LogLevel = "INFO"
|
|
|
|
options.LogEncoding = "console"
|
|
|
|
|
2022-08-12 12:44:13 +00:00
|
|
|
cliFlags := []cli.Flag{
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "tcp-port",
|
|
|
|
Aliases: []string{"port", "p"},
|
|
|
|
Value: 60000,
|
|
|
|
Usage: "Libp2p TCP listening port (0 for random)",
|
|
|
|
Destination: &options.Port,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "address",
|
|
|
|
Aliases: []string{"host", "listen-address"},
|
|
|
|
Value: "0.0.0.0",
|
|
|
|
Usage: "Listening address",
|
|
|
|
Destination: &options.Address,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "websocket-support",
|
|
|
|
Aliases: []string{"ws"},
|
|
|
|
Usage: "Enable websockets support",
|
|
|
|
Destination: &options.Websocket.Enable,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "websocket-port",
|
|
|
|
Aliases: []string{"ws-port"},
|
|
|
|
Value: 60001,
|
|
|
|
Usage: "Libp2p TCP listening port for websocket connection (0 for random)",
|
2022-08-25 20:36:04 +00:00
|
|
|
Destination: &options.Websocket.WSPort,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "websocket-secure-port",
|
|
|
|
Aliases: []string{"wss-port"},
|
|
|
|
Value: 6443,
|
|
|
|
Usage: "Libp2p TCP listening port for secure websocket connection (0 for random, binding to 443 requires root access)",
|
|
|
|
Destination: &options.Websocket.WSSPort,
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "websocket-address",
|
|
|
|
Aliases: []string{"ws-address"},
|
|
|
|
Value: "0.0.0.0",
|
|
|
|
Usage: "Listening address for websocket connections",
|
|
|
|
Destination: &options.Websocket.Address,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "websocket-secure-support",
|
|
|
|
Aliases: []string{"wss"},
|
|
|
|
Usage: "Enable secure websockets support",
|
|
|
|
Destination: &options.Websocket.Secure,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.PathFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "websocket-secure-key-path",
|
|
|
|
Aliases: []string{"wss-key"},
|
|
|
|
Value: "/path/to/key.txt",
|
|
|
|
Usage: "Secure websocket key path",
|
|
|
|
Destination: &options.Websocket.KeyPath,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.PathFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "websocket-secure-cert-path",
|
|
|
|
Aliases: []string{"wss-cert"},
|
|
|
|
Value: "/path/to/cert.txt",
|
|
|
|
Usage: "Secure websocket certificate path",
|
|
|
|
Destination: &options.Websocket.CertPath,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "dns4-domain-name",
|
|
|
|
Value: "",
|
|
|
|
Usage: "The domain name resolving to the node's public IPv4 address",
|
|
|
|
Destination: &options.Dns4DomainName,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "nodekey",
|
|
|
|
Usage: "P2P node private key as hex. Can also be set with GOWAKU-NODEKEY env variable (default random)",
|
|
|
|
Value: &cliutils.PrivateKeyValue{
|
|
|
|
Value: &options.NodeKey,
|
|
|
|
},
|
|
|
|
EnvVars: []string{"GOWAKU-NODEKEY"},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.PathFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "key-file",
|
|
|
|
Value: "./nodekey",
|
|
|
|
Usage: "Path to a file containing the private key for the P2P node",
|
|
|
|
Destination: &options.KeyFile,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "key-password",
|
|
|
|
Value: "secret",
|
|
|
|
Usage: "Password used for the private key file",
|
|
|
|
Destination: &options.KeyPasswd,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "generate-key",
|
|
|
|
Usage: "Generate private key file at path specified in --key-file with the password defined by --key-password",
|
|
|
|
Destination: &options.GenerateKey,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "overwrite",
|
|
|
|
Usage: "When generating a keyfile, overwrite the nodekey file if it already exists",
|
|
|
|
Destination: &options.Overwrite,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "staticnode",
|
|
|
|
Usage: "Multiaddr of peer to directly connect with. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.StaticNodes,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.DurationFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "keep-alive",
|
2022-11-25 20:55:06 +00:00
|
|
|
Value: 5 * time.Minute,
|
|
|
|
Usage: "Interval of time for pinging peers to keep the connection alive.",
|
2022-08-12 12:44:13 +00:00
|
|
|
Destination: &options.KeepAlive,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "use-db",
|
|
|
|
Aliases: []string{"sqlite-store"},
|
|
|
|
Usage: "Use SQLiteDB to persist information",
|
|
|
|
Destination: &options.UseDB,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "persist-peers",
|
|
|
|
Usage: "Enable peer persistence",
|
|
|
|
Destination: &options.PersistPeers,
|
|
|
|
Value: false,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "nat", // This was added so js-waku test don't fail
|
|
|
|
Usage: "TODO: Not implemented yet. Specify method to use for determining public address: any, none ('any' will attempt upnp/pmp)",
|
|
|
|
Value: "any",
|
|
|
|
Destination: &options.NAT, // TODO: accept none,any,upnp,extaddr
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.PathFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "db-path",
|
|
|
|
Aliases: []string{"dbpath"},
|
|
|
|
Value: "./store.db",
|
|
|
|
Usage: "Path to DB file",
|
|
|
|
Destination: &options.DBPath,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "advertise-address",
|
|
|
|
Usage: "External address to advertise to other nodes (overrides --address and --ws-address flags)",
|
|
|
|
Destination: &options.AdvertiseAddress,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "show-addresses",
|
|
|
|
Usage: "Display listening addresses according to current configuration",
|
|
|
|
Destination: &options.ShowAddresses,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "log-level",
|
|
|
|
Aliases: []string{"l"},
|
|
|
|
Value: &cliutils.ChoiceValue{
|
|
|
|
Choices: []string{"DEBUG", "INFO", "WARN", "ERROR", "DPANIC", "PANIC", "FATAL"},
|
|
|
|
Value: &options.LogLevel,
|
|
|
|
},
|
|
|
|
Usage: "Define the logging level,",
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "log-encoding",
|
|
|
|
Usage: "Define the encoding used for the logs",
|
|
|
|
Value: &cliutils.ChoiceValue{
|
2022-11-02 10:39:13 +00:00
|
|
|
Choices: []string{"console", "nocolor", "json"},
|
2022-08-15 17:13:45 +00:00
|
|
|
Value: &options.LogEncoding,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
2022-11-02 10:39:13 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "log-output",
|
|
|
|
Value: "stdout",
|
|
|
|
Usage: "specifies where logging output should be written (stdout, file, file:./filename.log)",
|
|
|
|
Destination: &options.LogOutput,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "version",
|
|
|
|
Value: false,
|
|
|
|
Usage: "prints the version",
|
|
|
|
Destination: &options.Version,
|
|
|
|
},
|
2022-10-26 13:28:28 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "agent-string",
|
|
|
|
Value: "go-waku",
|
|
|
|
Usage: "client id to advertise",
|
|
|
|
Destination: &options.UserAgent,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "relay",
|
|
|
|
Value: true,
|
|
|
|
Usage: "Enable relay protocol",
|
|
|
|
Destination: &options.Relay.Enable,
|
|
|
|
},
|
|
|
|
&cli.StringSliceFlag{
|
|
|
|
Name: "topics",
|
|
|
|
Usage: "List of topics to listen",
|
|
|
|
Destination: &options.Relay.Topics,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "relay-peer-exchange",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable GossipSub Peer Exchange",
|
|
|
|
Destination: &options.Relay.PeerExchange,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "min-relay-peers-to-publish",
|
|
|
|
Value: 1,
|
|
|
|
Usage: "Minimum number of peers to publish to Relay",
|
|
|
|
Destination: &options.Relay.MinRelayPeersToPublish,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "store",
|
2022-09-12 19:58:15 +00:00
|
|
|
Usage: "Enable store protocol to persist messages",
|
2022-08-12 12:44:13 +00:00
|
|
|
Destination: &options.Store.Enable,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "resume",
|
|
|
|
Usage: "Fix the gaps in message history",
|
|
|
|
Destination: &options.Store.ShouldResume,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.DurationFlag{
|
|
|
|
Name: "store-duration",
|
|
|
|
Value: time.Hour * 24 * 30,
|
2022-08-12 12:44:13 +00:00
|
|
|
Usage: "maximum number of seconds before a message is removed from the store",
|
2022-08-15 17:13:45 +00:00
|
|
|
Destination: &options.Store.RetentionTime,
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "store-capacity",
|
|
|
|
Value: 50000,
|
|
|
|
Usage: "maximum number of messages to store",
|
|
|
|
Destination: &options.Store.RetentionMaxMessages,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "storenode",
|
|
|
|
Usage: "Multiaddr of a peer that supports store protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.Store.Nodes,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "swap",
|
|
|
|
Usage: "Enable swap protocol",
|
|
|
|
Value: false,
|
|
|
|
Destination: &options.Swap.Enable,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "swap-mode",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "Swap mode: 0=soft, 1=mock, 2=hard",
|
|
|
|
Destination: &options.Swap.Mode,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "swap-payment-threshold",
|
|
|
|
Value: 100,
|
|
|
|
Usage: "Threshold for payment",
|
|
|
|
Destination: &options.Swap.PaymentThreshold,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "swap-disconnect-threshold",
|
|
|
|
Value: -100,
|
|
|
|
Usage: "Threshold for disconnecting",
|
|
|
|
Destination: &options.Swap.DisconnectThreshold,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "filter",
|
|
|
|
Usage: "Enable filter protocol",
|
|
|
|
Destination: &options.Filter.Enable,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "light-client",
|
|
|
|
Usage: "Don't accept filter subscribers",
|
|
|
|
Destination: &options.Filter.DisableFullNode,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "filternode",
|
|
|
|
Usage: "Multiaddr of a peer that supports filter protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.Filter.Nodes,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.DurationFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "filter-timeout",
|
2022-08-15 17:13:45 +00:00
|
|
|
Value: 14400 * time.Second,
|
2022-08-12 12:44:13 +00:00
|
|
|
Usage: "Timeout for filter node in seconds",
|
|
|
|
Destination: &options.Filter.Timeout,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "lightpush",
|
|
|
|
Usage: "Enable lightpush protocol",
|
|
|
|
Destination: &options.LightPush.Enable,
|
|
|
|
},
|
2022-08-15 17:13:45 +00:00
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "lightpushnode",
|
|
|
|
Usage: "Multiaddr of a peer that supports lightpush protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.LightPush.Nodes,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "discv5-discovery",
|
|
|
|
Usage: "Enable discovering nodes via Node Discovery v5",
|
|
|
|
Destination: &options.DiscV5.Enable,
|
|
|
|
},
|
|
|
|
&cli.StringSliceFlag{
|
|
|
|
Name: "discv5-bootstrap-node",
|
|
|
|
Usage: "Text-encoded ENR for bootstrap node. Used when connecting to the network. Option may be repeated",
|
|
|
|
Destination: &options.DiscV5.Nodes,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "discv5-udp-port",
|
|
|
|
Value: 9000,
|
|
|
|
Usage: "Listening UDP port for Node Discovery v5.",
|
|
|
|
Destination: &options.DiscV5.Port,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "discv5-enr-auto-update",
|
|
|
|
Usage: "Discovery can automatically update its ENR with the IP address as seen by other nodes it communicates with.",
|
|
|
|
Destination: &options.DiscV5.AutoUpdate,
|
|
|
|
},
|
2022-10-23 13:13:43 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "peer-exchange",
|
|
|
|
Usage: "Enable waku peer exchange protocol (responder side)",
|
|
|
|
Destination: &options.PeerExchange.Enable,
|
|
|
|
},
|
|
|
|
&cli.GenericFlag{
|
|
|
|
Name: "peer-exchange-node",
|
|
|
|
Usage: "Peer multiaddr to send peer exchange requests to. (enables peer exchange protocol requester side)",
|
|
|
|
Value: &cliutils.MultiaddrValue{
|
|
|
|
Value: &options.PeerExchange.Node,
|
|
|
|
},
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "dns-discovery",
|
|
|
|
Usage: "Enable DNS discovery",
|
|
|
|
Destination: &options.DNSDiscovery.Enable,
|
|
|
|
},
|
2022-09-14 19:19:11 +00:00
|
|
|
&cli.StringSliceFlag{
|
2022-08-12 12:44:13 +00:00
|
|
|
Name: "dns-discovery-url",
|
|
|
|
Usage: "URL for DNS node list in format 'enrtree://<key>@<fqdn>'",
|
2022-09-14 19:19:11 +00:00
|
|
|
Destination: &options.DNSDiscovery.URLs,
|
2022-08-12 12:44:13 +00:00
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "dns-discovery-name-server",
|
|
|
|
Aliases: []string{"dns-discovery-nameserver"},
|
|
|
|
Usage: "DNS nameserver IP to query (empty to use system's default)",
|
|
|
|
Destination: &options.DNSDiscovery.Nameserver,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "metrics-server",
|
|
|
|
Aliases: []string{"metrics"},
|
|
|
|
Usage: "Enable the metrics server",
|
|
|
|
Destination: &options.Metrics.Enable,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "metrics-server-address",
|
|
|
|
Aliases: []string{"metrics-address"},
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the metrics server",
|
|
|
|
Destination: &options.Metrics.Address,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "metrics-server-port",
|
|
|
|
Aliases: []string{"metrics-port"},
|
|
|
|
Value: 8008,
|
|
|
|
Usage: "Listening HTTP port of the metrics server",
|
|
|
|
Destination: &options.Metrics.Port,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rpc",
|
|
|
|
Usage: "Enable the rpc server",
|
|
|
|
Destination: &options.RPCServer.Enable,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "rpc-port",
|
|
|
|
Value: 8545,
|
|
|
|
Usage: "Listening port of the rpc server",
|
|
|
|
Destination: &options.RPCServer.Port,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "rpc-address",
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the rpc server",
|
|
|
|
Destination: &options.RPCServer.Address,
|
|
|
|
},
|
2022-10-20 13:18:23 +00:00
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "rpc-relay-cache-capacity",
|
|
|
|
Value: 30,
|
|
|
|
Usage: "Capacity of the Relay REST API message cache",
|
|
|
|
Destination: &options.RPCServer.RelayCacheCapacity,
|
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rpc-admin",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to JSON-RPC Admin API",
|
|
|
|
Destination: &options.RPCServer.Admin,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rpc-private",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to JSON-RPC Private API",
|
|
|
|
Destination: &options.RPCServer.Private,
|
|
|
|
},
|
2022-07-24 20:51:42 +00:00
|
|
|
|
2022-08-12 12:44:13 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rest",
|
|
|
|
Usage: "Enable Waku REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Enable,
|
2022-02-21 15:23:52 +00:00
|
|
|
},
|
2022-08-12 12:44:13 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "rest-address",
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Address,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "rest-port",
|
|
|
|
Value: 8645,
|
|
|
|
Usage: "Listening port of the REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Port,
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Name: "rest-relay-cache-capacity",
|
|
|
|
Value: 30,
|
|
|
|
Usage: "Capacity of the Relay REST API message cache",
|
|
|
|
Destination: &options.RESTServer.RelayCacheCapacity,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rest-admin",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to REST HTTP Admin API",
|
|
|
|
Destination: &options.RESTServer.Admin,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
Name: "rest-private",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to REST HTTP Private API",
|
|
|
|
Destination: &options.RESTServer.Private,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
rlnFlags := rlnFlags()
|
|
|
|
cliFlags = append(cliFlags, rlnFlags...)
|
|
|
|
|
|
|
|
app := &cli.App{
|
|
|
|
Flags: cliFlags,
|
2022-02-21 15:23:52 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2022-11-02 10:39:13 +00:00
|
|
|
utils.InitLogger(options.LogEncoding, options.LogOutput)
|
|
|
|
|
2022-02-21 15:23:52 +00:00
|
|
|
lvl, err := logging.LevelFromString(options.LogLevel)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
logging.SetAllLoggers(lvl)
|
2021-10-03 21:45:07 +00:00
|
|
|
|
2022-02-21 15:23:52 +00:00
|
|
|
waku.Execute(options)
|
|
|
|
return nil
|
|
|
|
},
|
2021-03-22 16:45:13 +00:00
|
|
|
}
|
|
|
|
|
2022-02-21 15:23:52 +00:00
|
|
|
err := app.Run(os.Args)
|
2022-01-18 18:17:06 +00:00
|
|
|
if err != nil {
|
2022-02-21 15:23:52 +00:00
|
|
|
panic(err)
|
2022-01-18 18:17:06 +00:00
|
|
|
}
|
2021-03-18 23:21:45 +00:00
|
|
|
}
|