libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
323 stars 187 forks source link

Enables injectable GossipSub router #503

Closed yhassanzadeh13 closed 1 year ago

yhassanzadeh13 commented 1 year ago

This PR provides an alternative constructor for GossipSub, which is called NewGossipSubWithRouter. In contrast to the existing NewGossipSub constructor that builds a GossipSub instance with the default router, the NewGossipSubWithRouter alternative is capable of building a GossipSub instance with arbitrary PubsubRouter. This empowers building more application-specific routers and injecting them into GossipSub, e.g., the router with an application-specific metric collection.