libp2p / go-libp2p-pubsub

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

Topic Subscription filters #389

Closed vyzo closed 3 years ago

vyzo commented 3 years ago

Topic Subscription Filters

This adds support for subscription filters, which allows the user to explicitly specify topics of interest to the pubsub system. Only topics that satisfy the filter will be tracked for other peers, which reduces processing load and memory requirements in the system. Similarly, the user will be able to join only topics allowed by the filter.

Usage

The filter is enabled by passing the WithSubscriptionFilter option to the pubsub constructor. A couple of basic filters are provided as part of the library; the user may implement more elaborate filtering logic by implementing the SubscriptionFilter interface