Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Packet-level filtering #275

Merged
merged 6 commits into from
Nov 29, 2023

Conversation

clockworkgr
Copy link
Collaborator

This PR adds the option to only relay specific packets that are of interest to the app developer.

In order to avoid unnecessary development and maintenance overhead, the filtering mechanism is left entirely to the app developer.

This is achieved by defining a new function type: PacketFilter that takes a Packet as an argument and returns true if it should be relayed and false if it should be ignored.

Implementation of this function is left to the application developer and can be used by setting it via link.setFilter(packetFilter: PacketFilter) on the Link instance.

This PR also includes the complementary Link.clearFilter() method.

Copy link

changeset-bot bot commented Nov 28, 2023

🦋 Changeset detected

Latest commit: 2835b3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@confio/relayer Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering looks good to me, just the newline

src/lib/link.ts Show resolved Hide resolved
@webmaster128 webmaster128 merged commit 85ac504 into confio:main Nov 29, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants