feat: add gossipsub peer exchange option to wakuV2
This commit is contained in:
parent
bbafc704b1
commit
524e864398
|
@ -254,6 +254,7 @@ func (b *StatusNode) wakuV2Service(nodeKey string, wakuCfg *params.WakuV2Config,
|
|||
StoreNodes: clusterCfg.StoreNodes,
|
||||
FilterNodes: clusterCfg.FilterNodes,
|
||||
LightpushNodes: clusterCfg.LightpushNodes,
|
||||
PeerExchange: clusterCfg.PeerExchange,
|
||||
}
|
||||
|
||||
if cfg.Host == "" {
|
||||
|
|
|
@ -288,6 +288,9 @@ type ClusterConfig struct {
|
|||
|
||||
// LightpushNodes is a list of wakuv2 lightpush nodes (libp2p)
|
||||
LightpushNodes []string
|
||||
|
||||
// PeerExchange determines whether GossipSub Peer Exchange is enabled or not
|
||||
PeerExchange bool
|
||||
}
|
||||
|
||||
// String dumps config object as nicely indented JSON
|
||||
|
|
|
@ -28,6 +28,7 @@ type Config struct {
|
|||
SoftBlacklistedPeerIDs []string `toml:",omitempty"`
|
||||
Host string `toml:",omitempty"`
|
||||
Port int `toml:",omitempty"`
|
||||
PeerExchange bool `toml:",omitempty"`
|
||||
KeepAliveInterval int `toml:",omitempty"`
|
||||
LightClient bool `toml:",omitempty"`
|
||||
RelayNodes []string `toml:",omitempty"`
|
||||
|
|
|
@ -179,7 +179,16 @@ func New(nodeKey string, cfg *Config, logger *zap.Logger) (*Waku, error) {
|
|||
opts = append(opts, node.WithLightPush())
|
||||
opts = append(opts, node.WithWakuFilter())
|
||||
} else {
|
||||
opts = append(opts, node.WithWakuRelay(wakurelay.WithMaxMessageSize(int(waku.settings.MaxMsgSize))))
|
||||
relayOpts := []wakurelay.Option{
|
||||
wakurelay.WithMaxMessageSize(int(waku.settings.MaxMsgSize)),
|
||||
wakurelay.WithPeerExchange(cfg.PeerExchange),
|
||||
}
|
||||
|
||||
if cfg.PeerExchange {
|
||||
relayOpts = append(relayOpts, wakurelay.WithPeerExchange(true))
|
||||
}
|
||||
|
||||
opts = append(opts, node.WithWakuRelay(relayOpts...))
|
||||
}
|
||||
|
||||
if waku.node, err = node.New(context.Background(), opts...); err != nil {
|
||||
|
|
Loading…
Reference in New Issue