Yusef Napora f0762b1814
add baseline pubsub test plan (#6)
* refactor baseline test out of private repo

* rm references to attackers

* fix default plan name & add widget to override

* add configs for local runners

* update runner notebook intro text

* fix build tags

* increase setup time in saved configs
2020-05-15 14:09:41 -04:00

39 lines
976 B
Go

// +build !hardened_api
// This file is used when the hardened_api build tag is not present.
// It targets the go-libp2p-pubsub API before GossipSub v1.1.0 was introduced.
// When using this file, peer scores will not be present in the test output.
package main
import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
)
func pubsubOptions(cfg PubsubNodeConfig) ([]pubsub.Option, error) {
opts := []pubsub.Option{
pubsub.WithEventTracer(cfg.Tracer),
}
if cfg.ValidateQueueSize > 0 {
opts = append(opts, pubsub.WithValidateQueueSize(cfg.ValidateQueueSize))
}
if cfg.OutboundQueueSize > 0 {
opts = append(opts, pubsub.WithPeerOutboundQueueSize(cfg.OutboundQueueSize))
}
// Set the overlay parameters
if cfg.OverlayParams.d >= 0 {
pubsub.GossipSubD = cfg.OverlayParams.d
}
if cfg.OverlayParams.dlo >= 0 {
pubsub.GossipSubDlo = cfg.OverlayParams.dlo
}
if cfg.OverlayParams.dhi >= 0 {
pubsub.GossipSubDhi = cfg.OverlayParams.dhi
}
return opts, nil
}