mirror of https://github.com/status-im/go-waku.git
feat: add gossipsub peer exchange option to waku node (#53)
This commit is contained in:
parent
37a01edce4
commit
5c9a29524d
12
waku/node.go
12
waku/node.go
|
@ -29,6 +29,8 @@ import (
|
||||||
"github.com/status-im/go-waku/waku/v2/discovery"
|
"github.com/status-im/go-waku/waku/v2/discovery"
|
||||||
"github.com/status-im/go-waku/waku/v2/node"
|
"github.com/status-im/go-waku/waku/v2/node"
|
||||||
"github.com/status-im/go-waku/waku/v2/protocol/relay"
|
"github.com/status-im/go-waku/waku/v2/protocol/relay"
|
||||||
|
|
||||||
|
pubsub "github.com/status-im/go-wakurelay-pubsub"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("wakunode")
|
var log = logging.Logger("wakunode")
|
||||||
|
@ -79,6 +81,7 @@ var rootCmd = &cobra.Command{
|
||||||
enableDnsDiscovery, _ := cmd.Flags().GetBool("dns-discovery")
|
enableDnsDiscovery, _ := cmd.Flags().GetBool("dns-discovery")
|
||||||
dnsDiscoveryUrl, _ := cmd.Flags().GetString("dns-discovery-url")
|
dnsDiscoveryUrl, _ := cmd.Flags().GetString("dns-discovery-url")
|
||||||
dnsDiscoveryNameServer, _ := cmd.Flags().GetString("dns-discovery-nameserver")
|
dnsDiscoveryNameServer, _ := cmd.Flags().GetString("dns-discovery-nameserver")
|
||||||
|
peerExchange, _ := cmd.Flags().GetBool("peer-exchange")
|
||||||
|
|
||||||
hostAddr, _ := net.ResolveTCPAddr("tcp", fmt.Sprint("0.0.0.0:", port))
|
hostAddr, _ := net.ResolveTCPAddr("tcp", fmt.Sprint("0.0.0.0:", port))
|
||||||
|
|
||||||
|
@ -140,7 +143,13 @@ var rootCmd = &cobra.Command{
|
||||||
nodeOpts = append(nodeOpts, node.WithLibP2POptions(libp2pOpts...))
|
nodeOpts = append(nodeOpts, node.WithLibP2POptions(libp2pOpts...))
|
||||||
|
|
||||||
if wakuRelay {
|
if wakuRelay {
|
||||||
nodeOpts = append(nodeOpts, node.WithWakuRelay())
|
var wakurelayopts []pubsub.Option
|
||||||
|
|
||||||
|
if peerExchange {
|
||||||
|
wakurelayopts = append(wakurelayopts, pubsub.WithPeerExchange(true))
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeOpts = append(nodeOpts, node.WithWakuRelay(wakurelayopts...))
|
||||||
}
|
}
|
||||||
|
|
||||||
if wakuFilter {
|
if wakuFilter {
|
||||||
|
@ -302,6 +311,7 @@ func init() {
|
||||||
rootCmd.Flags().Bool("dns-discovery", false, "enable dns discovery")
|
rootCmd.Flags().Bool("dns-discovery", false, "enable dns discovery")
|
||||||
rootCmd.Flags().String("dns-discovery-url", "", "URL for DNS node list in format 'enrtree://<key>@<fqdn>'")
|
rootCmd.Flags().String("dns-discovery-url", "", "URL for DNS node list in format 'enrtree://<key>@<fqdn>'")
|
||||||
rootCmd.Flags().String("dns-discovery-nameserver", "", "DNS nameserver IP to query (empty to use system's default)")
|
rootCmd.Flags().String("dns-discovery-nameserver", "", "DNS nameserver IP to query (empty to use system's default)")
|
||||||
|
rootCmd.Flags().Bool("peer-exchange", true, "Enable GossipSub Peer Exchange")
|
||||||
}
|
}
|
||||||
|
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
|
|
Loading…
Reference in New Issue