2022-12-06 17:14:05 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2023-01-11 15:58:49 +00:00
|
|
|
cli "github.com/urfave/cli/v2"
|
|
|
|
"github.com/urfave/cli/v2/altsrc"
|
2022-12-06 17:14:05 +00:00
|
|
|
"github.com/waku-org/go-waku/waku/cliutils"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2023-01-11 15:58:49 +00:00
|
|
|
TcpPort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "tcp-port",
|
|
|
|
Aliases: []string{"port", "p"},
|
|
|
|
Value: 60000,
|
|
|
|
Usage: "Libp2p TCP listening port (0 for random)",
|
|
|
|
Destination: &options.Port,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_TCP_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Address = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "address",
|
|
|
|
Aliases: []string{"host", "listen-address"},
|
|
|
|
Value: "0.0.0.0",
|
|
|
|
Usage: "Listening address",
|
|
|
|
Destination: &options.Address,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_ADDRESS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketSupport = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "websocket-support",
|
|
|
|
Aliases: []string{"ws"},
|
|
|
|
Usage: "Enable websockets support",
|
|
|
|
Destination: &options.Websocket.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_SUPPORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketPort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "websocket-port",
|
|
|
|
Aliases: []string{"ws-port"},
|
|
|
|
Value: 60001,
|
|
|
|
Usage: "Libp2p TCP listening port for websocket connection (0 for random)",
|
|
|
|
Destination: &options.Websocket.WSPort,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketSecurePort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_SECURE_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketAddress = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "websocket-address",
|
|
|
|
Aliases: []string{"ws-address"},
|
|
|
|
Value: "0.0.0.0",
|
|
|
|
Usage: "Listening address for websocket connections",
|
|
|
|
Destination: &options.Websocket.Address,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_ADDRESS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketSecureSupport = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "websocket-secure-support",
|
|
|
|
Aliases: []string{"wss"},
|
|
|
|
Usage: "Enable secure websockets support",
|
|
|
|
Destination: &options.Websocket.Secure,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_SECURE_SUPPORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketSecureKeyPath = altsrc.NewPathFlag(&cli.PathFlag{
|
2022-12-06 17:14:05 +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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_SECURE_KEY_PATH"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
WebsocketSecureCertPath = altsrc.NewPathFlag(&cli.PathFlag{
|
2022-12-06 17:14:05 +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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_SECURE_CERT_PATH"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Dns4DomainName = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "dns4-domain-name",
|
|
|
|
Value: "",
|
|
|
|
Usage: "The domain name resolving to the node's public IPv4 address",
|
|
|
|
Destination: &options.Dns4DomainName,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_WEBSOCKET_DNS4_DOMAIN_NAME"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
NodeKey = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_NODEKEY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
KeyFile = altsrc.NewPathFlag(&cli.PathFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "key-file",
|
|
|
|
Value: "./nodekey",
|
|
|
|
Usage: "Path to a file containing the private key for the P2P node",
|
|
|
|
Destination: &options.KeyFile,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_KEY_FILE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
KeyPassword = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "key-password",
|
|
|
|
Value: "secret",
|
|
|
|
Usage: "Password used for the private key file",
|
|
|
|
Destination: &options.KeyPasswd,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_KEY_PASSWORD"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
GenerateKey = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "generate-key",
|
|
|
|
Usage: "Generate private key file at path specified in --key-file with the password defined by --key-password",
|
|
|
|
Destination: &options.GenerateKey,
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Overwrite = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "overwrite",
|
|
|
|
Usage: "When generating a keyfile, overwrite the nodekey file if it already exists",
|
|
|
|
Destination: &options.Overwrite,
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StaticNode = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "staticnode",
|
|
|
|
Usage: "Multiaddr of peer to directly connect with. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.StaticNodes,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STATICNODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
KeepAlive = altsrc.NewDurationFlag(&cli.DurationFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "keep-alive",
|
|
|
|
Value: 5 * time.Minute,
|
|
|
|
Usage: "Interval of time for pinging peers to keep the connection alive.",
|
|
|
|
Destination: &options.KeepAlive,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_KEEP_ALIVE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
PersistPeers = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "persist-peers",
|
|
|
|
Usage: "Enable peer persistence",
|
|
|
|
Destination: &options.PersistPeers,
|
|
|
|
Value: false,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_PERSIST_PEERS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
NAT = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_NAT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
2023-02-08 16:02:06 +00:00
|
|
|
AdvertiseAddress = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
|
|
|
Name: "ext-multiaddr",
|
|
|
|
Usage: "External address to advertise to other nodes. Ooverrides --address and --ws-address flags. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.AdvertiseAddresses,
|
|
|
|
},
|
|
|
|
EnvVars: []string{"WAKUNODE2_EXT_MULTIADDR"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
ShowAddresses = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "show-addresses",
|
|
|
|
Usage: "Display listening addresses according to current configuration",
|
|
|
|
Destination: &options.ShowAddresses,
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
LogLevel = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "log-level",
|
|
|
|
Aliases: []string{"l"},
|
|
|
|
Value: &cliutils.ChoiceValue{
|
|
|
|
Choices: []string{"DEBUG", "INFO", "WARN", "ERROR", "DPANIC", "PANIC", "FATAL"},
|
|
|
|
Value: &options.LogLevel,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
Usage: "Define the logging level (allowed values: DEBUG, INFO, WARN, ERROR, DPANIC, PANIC, FATAL)",
|
|
|
|
EnvVars: []string{"WAKUNODE2_LOG_LEVEL"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
LogEncoding = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "log-encoding",
|
2022-12-14 16:22:48 +00:00
|
|
|
Usage: "Define the encoding used for the logs (allowed values: console, nocolor, json)",
|
2022-12-06 17:14:05 +00:00
|
|
|
Value: &cliutils.ChoiceValue{
|
|
|
|
Choices: []string{"console", "nocolor", "json"},
|
|
|
|
Value: &options.LogEncoding,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_LOG_ENCODING"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
LogOutput = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "log-output",
|
|
|
|
Value: "stdout",
|
|
|
|
Usage: "specifies where logging output should be written (stdout, file, file:./filename.log)",
|
|
|
|
Destination: &options.LogOutput,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_LOG_OUTPUT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
AgentString = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "agent-string",
|
|
|
|
Value: "go-waku",
|
|
|
|
Usage: "client id to advertise",
|
|
|
|
Destination: &options.UserAgent,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_AGENT_STRING"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Relay = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "relay",
|
|
|
|
Value: true,
|
|
|
|
Usage: "Enable relay protocol",
|
|
|
|
Destination: &options.Relay.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RELAY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Topics = altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "topics",
|
|
|
|
Usage: "List of topics to listen",
|
|
|
|
Destination: &options.Relay.Topics,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_TOPICS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RelayPeerExchange = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "relay-peer-exchange",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable GossipSub Peer Exchange",
|
|
|
|
Destination: &options.Relay.PeerExchange,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RELAY_PEER_EXCHANGE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
MinRelayPeersToPublish = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "min-relay-peers-to-publish",
|
|
|
|
Value: 1,
|
|
|
|
Usage: "Minimum number of peers to publish to Relay",
|
|
|
|
Destination: &options.Relay.MinRelayPeersToPublish,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_MIN_RELAY_PEERS_TO_PUBLISH"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreNodeFlag = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "storenode",
|
|
|
|
Usage: "Multiaddr of a peer that supports store protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.Store.Nodes,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORENODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "store",
|
|
|
|
Usage: "Enable store protocol to persist messages",
|
|
|
|
Destination: &options.Store.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreMessageRetentionTime = altsrc.NewDurationFlag(&cli.DurationFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "store-message-retention-time",
|
|
|
|
Value: time.Hour * 24 * 2,
|
|
|
|
Usage: "maximum number of seconds before a message is removed from the store. Set to 0 to disable it",
|
|
|
|
Destination: &options.Store.RetentionTime,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORE_MESSAGE_RETENTION_TIME"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreMessageRetentionCapacity = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "store-message-retention-capacity",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "maximum number of messages to store. Set to 0 to disable it",
|
|
|
|
Destination: &options.Store.RetentionMaxMessages,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORE_MESSAGE_RETENTION_CAPACITY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreMessageDBURL = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-09 19:26:24 +00:00
|
|
|
Name: "store-message-db-url",
|
2022-12-10 11:25:26 +00:00
|
|
|
Usage: "The database connection URL for persistent storage.",
|
|
|
|
Value: "sqlite3://store.db",
|
2022-12-09 19:26:24 +00:00
|
|
|
Destination: &options.Store.DatabaseURL,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORE_MESSAGE_DB_URL"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
StoreResumePeer = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "store-resume-peer",
|
|
|
|
Usage: "Peer multiaddress to resume the message store at boot. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.Store.ResumeNodes,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_STORE_RESUME_PEER"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
SwapFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "swap",
|
|
|
|
Usage: "Enable swap protocol",
|
|
|
|
Value: false,
|
|
|
|
Destination: &options.Swap.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_SWAP"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
SwapMode = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "swap-mode",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "Swap mode: 0=soft, 1=mock, 2=hard",
|
|
|
|
Destination: &options.Swap.Mode,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_SWAP_MODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
SwapPaymentThreshold = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "swap-payment-threshold",
|
|
|
|
Value: 100,
|
|
|
|
Usage: "Threshold for payment",
|
|
|
|
Destination: &options.Swap.PaymentThreshold,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_SWAP_PAYMENT_THRESHOLD"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
SwapDisconnectThreshold = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "swap-disconnect-threshold",
|
|
|
|
Value: -100,
|
|
|
|
Usage: "Threshold for disconnecting",
|
|
|
|
Destination: &options.Swap.DisconnectThreshold,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_SWAP_DISCONNECT_THRESHOLD"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
FilterFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "filter",
|
|
|
|
Usage: "Enable filter protocol",
|
|
|
|
Destination: &options.Filter.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_FILTER"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
2023-02-07 22:28:46 +00:00
|
|
|
FilterV2Flag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
|
|
|
Name: "use-filterv2",
|
|
|
|
Usage: "Use filterV2 protocol (experimental)",
|
|
|
|
Destination: &options.Filter.UseV2,
|
|
|
|
EnvVars: []string{"WAKUNODE2_FILTERV2"},
|
|
|
|
})
|
2023-01-11 15:58:49 +00:00
|
|
|
LightClient = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "light-client",
|
|
|
|
Usage: "Don't accept filter subscribers",
|
|
|
|
Destination: &options.Filter.DisableFullNode,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_LIGHT_CLIENT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
FilterNode = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "filternode",
|
|
|
|
Usage: "Multiaddr of a peer that supports filter protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.Filter.Nodes,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_FILTERNODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
FilterTimeout = altsrc.NewDurationFlag(&cli.DurationFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "filter-timeout",
|
|
|
|
Value: 14400 * time.Second,
|
|
|
|
Usage: "Timeout for filter node in seconds",
|
|
|
|
Destination: &options.Filter.Timeout,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_FILTER_TIMEOUT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
LightPush = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "lightpush",
|
|
|
|
Usage: "Enable lightpush protocol",
|
|
|
|
Destination: &options.LightPush.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_LIGHTPUSH"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
LightPushNode = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "lightpushnode",
|
|
|
|
Usage: "Multiaddr of a peer that supports lightpush protocol. Option may be repeated",
|
|
|
|
Value: &cliutils.MultiaddrSlice{
|
|
|
|
Values: &options.LightPush.Nodes,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_LIGHTPUSHNODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Discv5Discovery = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "discv5-discovery",
|
|
|
|
Usage: "Enable discovering nodes via Node Discovery v5",
|
|
|
|
Destination: &options.DiscV5.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DISCV5_DISCOVERY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Discv5BootstrapNode = altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DISCV5_BOOTSTRAP_NODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
2023-01-12 02:20:23 +00:00
|
|
|
Discv5UDPPort = altsrc.NewUintFlag(&cli.UintFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "discv5-udp-port",
|
|
|
|
Value: 9000,
|
|
|
|
Usage: "Listening UDP port for Node Discovery v5.",
|
|
|
|
Destination: &options.DiscV5.Port,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DISCV5_UDP_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
Discv5ENRAutoUpdate = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DISCV5_ENR_AUTO_UPDATE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
PeerExchange = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "peer-exchange",
|
|
|
|
Usage: "Enable waku peer exchange protocol (responder side)",
|
|
|
|
Destination: &options.PeerExchange.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_PEER_EXCHANGE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
PeerExchangeNode = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
|
|
|
},
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_PEER_EXCHANGE_NODE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
DNSDiscovery = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "dns-discovery",
|
|
|
|
Usage: "Enable DNS discovery",
|
|
|
|
Destination: &options.DNSDiscovery.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DNS_DISCOVERY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
DNSDiscoveryUrl = altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "dns-discovery-url",
|
|
|
|
Usage: "URL for DNS node list in format 'enrtree://<key>@<fqdn>'",
|
|
|
|
Destination: &options.DNSDiscovery.URLs,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DNS_DISCOVERY_URL"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
DNSDiscoveryNameServer = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
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,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_DNS_DISCOVERY_NAME_SERVER"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
MetricsServer = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "metrics-server",
|
|
|
|
Aliases: []string{"metrics"},
|
|
|
|
Usage: "Enable the metrics server",
|
|
|
|
Destination: &options.Metrics.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_METRICS_SERVER"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
MetricsServerAddress = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "metrics-server-address",
|
|
|
|
Aliases: []string{"metrics-address"},
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the metrics server",
|
|
|
|
Destination: &options.Metrics.Address,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_METRICS_SERVER_ADDRESS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
MetricsServerPort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "metrics-server-port",
|
|
|
|
Aliases: []string{"metrics-port"},
|
|
|
|
Value: 8008,
|
|
|
|
Usage: "Listening HTTP port of the metrics server",
|
|
|
|
Destination: &options.Metrics.Port,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_METRICS_SERVER_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc",
|
|
|
|
Usage: "Enable the rpc server",
|
|
|
|
Destination: &options.RPCServer.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCPort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc-port",
|
|
|
|
Value: 8545,
|
|
|
|
Usage: "Listening port of the rpc server",
|
|
|
|
Destination: &options.RPCServer.Port,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCAddress = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc-address",
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the rpc server",
|
|
|
|
Destination: &options.RPCServer.Address,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC_ADDRESS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCRelayCacheCapacity = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc-relay-cache-capacity",
|
|
|
|
Value: 30,
|
|
|
|
Usage: "Capacity of the Relay REST API message cache",
|
|
|
|
Destination: &options.RPCServer.RelayCacheCapacity,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC_RELAY_CACHE_CAPACITY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCAdmin = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc-admin",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to JSON-RPC Admin API",
|
|
|
|
Destination: &options.RPCServer.Admin,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC_ADMIN"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RPCPrivate = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rpc-private",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to JSON-RPC Private API",
|
|
|
|
Destination: &options.RPCServer.Private,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_RPC_PRIVATE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest",
|
|
|
|
Usage: "Enable Waku REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Enable,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTAddress = altsrc.NewStringFlag(&cli.StringFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest-address",
|
|
|
|
Value: "127.0.0.1",
|
|
|
|
Usage: "Listening address of the REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Address,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST_ADDRESS"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTPort = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest-port",
|
|
|
|
Value: 8645,
|
|
|
|
Usage: "Listening port of the REST HTTP server",
|
|
|
|
Destination: &options.RESTServer.Port,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST_PORT"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTRelayCacheCapacity = altsrc.NewIntFlag(&cli.IntFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest-relay-cache-capacity",
|
|
|
|
Value: 30,
|
|
|
|
Usage: "Capacity of the Relay REST API message cache",
|
|
|
|
Destination: &options.RESTServer.RelayCacheCapacity,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST_RELAY_CACHE_CAPACITY"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTAdmin = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest-admin",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to REST HTTP Admin API",
|
|
|
|
Destination: &options.RESTServer.Admin,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST_ADMIN"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
RESTPrivate = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-06 17:14:05 +00:00
|
|
|
Name: "rest-private",
|
|
|
|
Value: false,
|
|
|
|
Usage: "Enable access to REST HTTP Private API",
|
|
|
|
Destination: &options.RESTServer.Private,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_REST_PRIVATE"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
|
|
|
PProf = altsrc.NewBoolFlag(&cli.BoolFlag{
|
2022-12-11 00:08:25 +00:00
|
|
|
Name: "pprof",
|
|
|
|
Usage: "provides runtime profiling data at /debug/pprof in both REST and RPC servers if they're enabled",
|
|
|
|
Destination: &options.PProf,
|
2023-01-03 19:51:43 +00:00
|
|
|
EnvVars: []string{"WAKUNODE2_PPROF"},
|
2023-01-11 15:58:49 +00:00
|
|
|
})
|
2022-12-06 17:14:05 +00:00
|
|
|
)
|