package dms3p2p import ( "gitlab.dms3.io/p2p/go-p2p-core/discovery" "gitlab.dms3.io/p2p/go-p2p-core/host" pubsub "gitlab.dms3.io/p2p/go-p2p-pubsub" "go.uber.org/fx" "gitlab.dms3.io/dms3/go-dms3/core/node/helpers" ) func FloodSub(pubsubOptions ...pubsub.Option) interface{} { return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, disc discovery.Discovery) (service *pubsub.PubSub, err error) { return pubsub.NewFloodSub(helpers.LifecycleCtx(mctx, lc), host, append(pubsubOptions, pubsub.WithDiscovery(disc))...) } } func GossipSub(pubsubOptions ...pubsub.Option) interface{} { return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, disc discovery.Discovery) (service *pubsub.PubSub, err error) { return pubsub.NewGossipSub(helpers.LifecycleCtx(mctx, lc), host, append( pubsubOptions, pubsub.WithDiscovery(disc), pubsub.WithFloodPublish(true))..., ) } }