go-waku/waku/options.go

85 lines
5.4 KiB
Go
Raw Normal View History

package waku
type RendezvousOptions struct {
Enable bool `long:"rendezvous" description:"Enable rendezvous protocol for peer discovery"`
2021-10-06 18:43:41 +00:00
Nodes []string `long:"rendezvous-node" description:"Multiaddr of a waku2 rendezvous node. Option may be repeated"`
}
type RendezvousServerOptions struct {
Enable bool `long:"rendezvous-server" description:"Node will act as rendezvous server"`
DBPath string `long:"rendezvous-db-path" description:"Path where peer records database will be stored" default:"/tmp/rendezvous"`
}
type RelayOptions struct {
Disable bool `long:"no-relay" description:"Disable relay protocol"`
Topics []string `long:"topics" description:"List of topics to listen"`
PeerExchange bool `long:"peer-exchange" description:"Enable GossipSub Peer Exchange"`
}
type FilterOptions struct {
Enable bool `long:"filter" description:"Enable filter protocol"`
Nodes []string `long:"filter-node" description:"Multiaddr of a peer that supports filter protocol. Option may be repeated"`
}
2021-10-09 18:18:53 +00:00
// LightpushOptions are settings used to enable the lightpush protocol. This is
// a lightweight protocol used to avoid having to run the relay protocol which
// is more resource intensive. With this protocol a message is pushed to a peer
// that supports both the lightpush protocol and relay protocol. That peer will
// broadcast the message and return a confirmation that the message was
// broadcasted
type LightpushOptions struct {
Enable bool `long:"lightpush" description:"Enable lightpush protocol"`
Nodes []string `long:"lightpush-node" description:"Multiaddr of a peer that supports lightpush protocol. Option may be repeated"`
}
2021-10-09 18:18:53 +00:00
// StoreOptions are settings used for enabling the store protocol, used to
// retrieve message history from other nodes as well as acting as a store
// node and provide message history to nodes that ask for it.
type StoreOptions struct {
2021-10-09 18:18:53 +00:00
Enable bool `long:"store" description:"Enable store protocol"`
ShouldResume bool `long:"resume" description:"fix the gap in message history"`
Nodes []string `long:"store-node" description:"Multiaddr of a peer that supports store protocol. Option may be repeated"`
}
2021-10-09 18:18:53 +00:00
// DNSDiscoveryOptions are settings used for enabling DNS-based discovery
// protocol that stores merkle trees in DNS records which contain connection
// information for nodes. It's very useful for bootstrapping a p2p network.
type DNSDiscoveryOptions struct {
Enable bool `long:"dns-discovery" description:"Enable DNS discovery"`
URL string `long:"dns-discovery-url" description:"URL for DNS node list in format 'enrtree://<key>@<fqdn>'"`
Nameserver string `long:"dns-discovery-nameserver" description:"DNS nameserver IP to query (empty to use system's default)"`
}
2021-10-09 18:18:53 +00:00
// MetricsOptions are settings used to start a prometheus server for obtaining
// useful node metrics to monitor the health of behavior of the go-waku node.
type MetricsOptions struct {
Enable bool `long:"metrics" description:"Enable the metrics server"`
Address string `long:"metrics-address" description:"Listening address of the metrics server" default:"127.0.0.1"`
Port int `long:"metrics-port" description:"Listening HTTP port of the metrics server" default:"8008"`
}
2021-10-09 18:18:53 +00:00
// Options contains all the available features and settings that can be
// configured via flags when executing go-waku as a service.
type Options struct {
Port int `short:"p" long:"port" description:"Libp2p TCP listening port (0 for random)" default:"9000"`
EnableWS bool `long:"ws" description:"Enable websockets support"`
WSPort int `long:"ws-port" description:"Libp2p TCP listening port for websocket connection (0 for random)" default:"9001"`
NodeKey string `long:"nodekey" description:"P2P node private key as hex. Can also be set with GOWAKU-NODEKEY env variable (default random)"`
KeyFile string `long:"key-file" description:"Path to a file containing the private key for the P2P node" default:"./nodekey"`
GenerateKey bool `long:"generate-key" description:"Generate private key file at path specified in --key-file"`
Overwrite bool `long:"overwrite" description:"When generating a keyfile, overwrite the nodekey file if it already exists"`
2021-10-06 18:43:41 +00:00
StaticNodes []string `long:"static-node" description:"Multiaddr of peer to directly connect with. Option may be repeated"`
KeepAlive int `long:"keep-alive" default:"20" description:"Interval in seconds for pinging peers to keep the connection alive."`
UseDB bool `long:"use-db" description:"Use SQLiteDB to persist information"`
DBPath string `long:"dbpath" default:"./store.db" description:"Path to DB file"`
2021-10-13 14:18:10 +00:00
LogLevel string `short:"l" long:"log-level" description:"Define the logging level, supported strings are: DEBUG, INFO, WARN, ERROR, DPANIC, PANIC, FATAL, and their lower-case forms." default:"INFO"`
Relay RelayOptions `group:"Relay Options"`
Store StoreOptions `group:"Store Options"`
Filter FilterOptions `group:"Filter Options"`
LightPush LightpushOptions `group:"LightPush Options"`
Rendezvous RendezvousOptions `group:"Rendezvous Options"`
RendezvousServer RendezvousServerOptions `group:"Rendezvous Server Options"`
DNSDiscovery DNSDiscoveryOptions `group:"DNS Discovery Options"`
Metrics MetricsOptions `group:"Metrics Options"`
}