mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 10:57:42 +08:00
22 lines
697 B
Go
22 lines
697 B
Go
package libp2p
|
|
|
|
import (
|
|
host "github.com/libp2p/go-libp2p-host"
|
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
|
"go.uber.org/fx"
|
|
|
|
"github.com/ipfs/go-ipfs/core/node/helpers"
|
|
)
|
|
|
|
func FloodSub(pubsubOptions ...pubsub.Option) interface{} {
|
|
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) (service *pubsub.PubSub, err error) {
|
|
return pubsub.NewFloodSub(helpers.LifecycleCtx(mctx, lc), host, pubsubOptions...)
|
|
}
|
|
}
|
|
|
|
func GossipSub(pubsubOptions ...pubsub.Option) interface{} {
|
|
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) (service *pubsub.PubSub, err error) {
|
|
return pubsub.NewGossipSub(helpers.LifecycleCtx(mctx, lc), host, pubsubOptions...)
|
|
}
|
|
}
|