mirror of https://github.com/status-im/go-waku.git
chore: update flags
This commit is contained in:
parent
0b01e4bb16
commit
c559932931
|
@ -263,49 +263,21 @@ var (
|
||||||
},
|
},
|
||||||
EnvVars: []string{"WAKUNODE2_STORE_RESUME_PEER"},
|
EnvVars: []string{"WAKUNODE2_STORE_RESUME_PEER"},
|
||||||
})
|
})
|
||||||
SwapFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
|
||||||
Name: "swap",
|
|
||||||
Usage: "Enable swap protocol",
|
|
||||||
Value: false,
|
|
||||||
Destination: &options.Swap.Enable,
|
|
||||||
EnvVars: []string{"WAKUNODE2_SWAP"},
|
|
||||||
})
|
|
||||||
SwapMode = altsrc.NewIntFlag(&cli.IntFlag{
|
|
||||||
Name: "swap-mode",
|
|
||||||
Value: 0,
|
|
||||||
Usage: "Swap mode: 0=soft, 1=mock, 2=hard",
|
|
||||||
Destination: &options.Swap.Mode,
|
|
||||||
EnvVars: []string{"WAKUNODE2_SWAP_MODE"},
|
|
||||||
})
|
|
||||||
SwapPaymentThreshold = altsrc.NewIntFlag(&cli.IntFlag{
|
|
||||||
Name: "swap-payment-threshold",
|
|
||||||
Value: 100,
|
|
||||||
Usage: "Threshold for payment",
|
|
||||||
Destination: &options.Swap.PaymentThreshold,
|
|
||||||
EnvVars: []string{"WAKUNODE2_SWAP_PAYMENT_THRESHOLD"},
|
|
||||||
})
|
|
||||||
SwapDisconnectThreshold = altsrc.NewIntFlag(&cli.IntFlag{
|
|
||||||
Name: "swap-disconnect-threshold",
|
|
||||||
Value: -100,
|
|
||||||
Usage: "Threshold for disconnecting",
|
|
||||||
Destination: &options.Swap.DisconnectThreshold,
|
|
||||||
EnvVars: []string{"WAKUNODE2_SWAP_DISCONNECT_THRESHOLD"},
|
|
||||||
})
|
|
||||||
FilterFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
FilterFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
||||||
Name: "filter",
|
Name: "filter",
|
||||||
Usage: "Enable filter protocol",
|
Usage: "Enable filter protocol",
|
||||||
Destination: &options.Filter.Enable,
|
Destination: &options.Filter.Enable,
|
||||||
EnvVars: []string{"WAKUNODE2_FILTER"},
|
EnvVars: []string{"WAKUNODE2_FILTER"},
|
||||||
})
|
})
|
||||||
FilterV2Flag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
FilterLegacyFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
|
||||||
Name: "use-filterv2",
|
Name: "use-filter-legacy",
|
||||||
Usage: "Use filterV2 protocol (experimental)",
|
Usage: "Use filter protocol (legacy)",
|
||||||
Destination: &options.Filter.UseV2,
|
Destination: &options.Filter.UseV1,
|
||||||
EnvVars: []string{"WAKUNODE2_FILTERV2"},
|
EnvVars: []string{"WAKUNODE2_USE_FILTER_LEGACY"},
|
||||||
})
|
})
|
||||||
LightClient = altsrc.NewBoolFlag(&cli.BoolFlag{
|
LightClient = altsrc.NewBoolFlag(&cli.BoolFlag{
|
||||||
Name: "light-client",
|
Name: "light-client",
|
||||||
Usage: "Don't accept filter subscribers",
|
Usage: "Don't accept filter subscribers (only for filter-legacy)",
|
||||||
Destination: &options.Filter.DisableFullNode,
|
Destination: &options.Filter.DisableFullNode,
|
||||||
EnvVars: []string{"WAKUNODE2_LIGHT_CLIENT"},
|
EnvVars: []string{"WAKUNODE2_LIGHT_CLIENT"},
|
||||||
})
|
})
|
||||||
|
@ -317,6 +289,14 @@ var (
|
||||||
},
|
},
|
||||||
EnvVars: []string{"WAKUNODE2_FILTERNODE"},
|
EnvVars: []string{"WAKUNODE2_FILTERNODE"},
|
||||||
})
|
})
|
||||||
|
FilterLegacyNode = cliutils.NewGenericFlagMultiValue(&cli.GenericFlag{
|
||||||
|
Name: "legacy-filternode",
|
||||||
|
Usage: "Multiaddr of a peer that supports legacy filter protocol. Option may be repeated",
|
||||||
|
Value: &cliutils.MultiaddrSlice{
|
||||||
|
Values: &options.Filter.NodesV1,
|
||||||
|
},
|
||||||
|
EnvVars: []string{"WAKUNODE2_LEGACY_FILTERNODE"},
|
||||||
|
})
|
||||||
FilterTimeout = altsrc.NewDurationFlag(&cli.DurationFlag{
|
FilterTimeout = altsrc.NewDurationFlag(&cli.DurationFlag{
|
||||||
Name: "filter-timeout",
|
Name: "filter-timeout",
|
||||||
Value: 14400 * time.Second,
|
Value: 14400 * time.Second,
|
||||||
|
|
|
@ -53,14 +53,11 @@ func main() {
|
||||||
StoreMessageRetentionTime,
|
StoreMessageRetentionTime,
|
||||||
StoreMessageRetentionCapacity,
|
StoreMessageRetentionCapacity,
|
||||||
StoreResumePeer,
|
StoreResumePeer,
|
||||||
SwapFlag,
|
|
||||||
SwapMode,
|
|
||||||
SwapPaymentThreshold,
|
|
||||||
SwapDisconnectThreshold,
|
|
||||||
FilterFlag,
|
FilterFlag,
|
||||||
FilterV2Flag,
|
FilterLegacyFlag,
|
||||||
LightClient,
|
LightClient,
|
||||||
FilterNode,
|
FilterNode,
|
||||||
|
FilterLegacyNode,
|
||||||
FilterTimeout,
|
FilterTimeout,
|
||||||
LightPush,
|
LightPush,
|
||||||
LightPushNode,
|
LightPushNode,
|
||||||
|
|
22
waku/node.go
22
waku/node.go
|
@ -163,15 +163,14 @@ func Execute(options Options) {
|
||||||
nodeOpts = append(nodeOpts, node.WithWakuRelayAndMinPeers(options.Relay.MinRelayPeersToPublish, wakurelayopts...))
|
nodeOpts = append(nodeOpts, node.WithWakuRelayAndMinPeers(options.Relay.MinRelayPeersToPublish, wakurelayopts...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeOpts = append(nodeOpts, node.WithWakuFilterLightNode())
|
||||||
|
|
||||||
if options.Filter.Enable {
|
if options.Filter.Enable {
|
||||||
if options.Filter.UseV2 {
|
nodeOpts = append(nodeOpts, node.WithWakuFilterFullNode(filter.WithTimeout(options.Filter.Timeout)))
|
||||||
nodeOpts = append(nodeOpts, node.WithWakuFilterLightNode())
|
}
|
||||||
if !options.Filter.DisableFullNode {
|
|
||||||
nodeOpts = append(nodeOpts, node.WithWakuFilterFullNode(filter.WithTimeout(options.Filter.Timeout)))
|
if options.Filter.UseV1 {
|
||||||
}
|
nodeOpts = append(nodeOpts, node.WithLegacyWakuFilter(!options.Filter.DisableFullNode, legacy_filter.WithTimeout(options.Filter.Timeout)))
|
||||||
} else {
|
|
||||||
nodeOpts = append(nodeOpts, node.WithLegacyWakuFilter(!options.Filter.DisableFullNode, legacy_filter.WithTimeout(options.Filter.Timeout)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var dbStore *persistence.DBStore
|
var dbStore *persistence.DBStore
|
||||||
|
@ -259,11 +258,10 @@ func Execute(options Options) {
|
||||||
addPeers(wakuNode, options.Store.Nodes, store.StoreID_v20beta4)
|
addPeers(wakuNode, options.Store.Nodes, store.StoreID_v20beta4)
|
||||||
addPeers(wakuNode, options.LightPush.Nodes, lightpush.LightPushID_v20beta1)
|
addPeers(wakuNode, options.LightPush.Nodes, lightpush.LightPushID_v20beta1)
|
||||||
addPeers(wakuNode, options.Rendezvous.Nodes, rendezvous.RendezvousID)
|
addPeers(wakuNode, options.Rendezvous.Nodes, rendezvous.RendezvousID)
|
||||||
|
addPeers(wakuNode, options.Filter.Nodes, filter.FilterSubscribeID_v20beta1)
|
||||||
|
|
||||||
if options.Filter.UseV2 {
|
if options.Filter.UseV1 {
|
||||||
addPeers(wakuNode, options.Filter.Nodes, legacy_filter.FilterID_v20beta1)
|
addPeers(wakuNode, options.Filter.NodesV1, legacy_filter.FilterID_v20beta1)
|
||||||
} else {
|
|
||||||
addPeers(wakuNode, options.Filter.Nodes, legacy_filter.FilterID_v20beta1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = wakuNode.Start(ctx); err != nil {
|
if err = wakuNode.Start(ctx); err != nil {
|
||||||
|
|
|
@ -47,9 +47,10 @@ type RLNRelayOptions struct {
|
||||||
// restricted devices.
|
// restricted devices.
|
||||||
type FilterOptions struct {
|
type FilterOptions struct {
|
||||||
Enable bool
|
Enable bool
|
||||||
UseV2 bool
|
UseV1 bool
|
||||||
DisableFullNode bool
|
DisableFullNode bool
|
||||||
Nodes []multiaddr.Multiaddr
|
Nodes []multiaddr.Multiaddr
|
||||||
|
NodesV1 []multiaddr.Multiaddr
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,14 +77,6 @@ type StoreOptions struct {
|
||||||
Nodes []multiaddr.Multiaddr
|
Nodes []multiaddr.Multiaddr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SwapOptions are settings used for configuring the swap protocol
|
|
||||||
type SwapOptions struct {
|
|
||||||
Enable bool
|
|
||||||
Mode int
|
|
||||||
PaymentThreshold int
|
|
||||||
DisconnectThreshold int
|
|
||||||
}
|
|
||||||
|
|
||||||
// DNSDiscoveryOptions are settings used for enabling DNS-based discovery
|
// DNSDiscoveryOptions are settings used for enabling DNS-based discovery
|
||||||
// protocol that stores merkle trees in DNS records which contain connection
|
// protocol that stores merkle trees in DNS records which contain connection
|
||||||
// information for nodes. It's very useful for bootstrapping a p2p network.
|
// information for nodes. It's very useful for bootstrapping a p2p network.
|
||||||
|
@ -172,7 +165,6 @@ type Options struct {
|
||||||
Websocket WSOptions
|
Websocket WSOptions
|
||||||
Relay RelayOptions
|
Relay RelayOptions
|
||||||
Store StoreOptions
|
Store StoreOptions
|
||||||
Swap SwapOptions
|
|
||||||
Filter FilterOptions
|
Filter FilterOptions
|
||||||
LightPush LightpushOptions
|
LightPush LightpushOptions
|
||||||
RLNRelay RLNRelayOptions
|
RLNRelay RLNRelayOptions
|
||||||
|
|
Loading…
Reference in New Issue