Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Add WireTap interface #444

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Add WireTap interface #444

merged 2 commits into from
Sep 24, 2020

Conversation

tzdybal
Copy link
Contributor

@tzdybal tzdybal commented Sep 21, 2020

WireTap interface can be used to access all messages send and received
by Bitswap. This can be used to implement advanced statistics/analysis
logic, which is beyond scope of Bitswap, but can be implemented as IPFS
plugin.

Some examples of potential applications:

I tried to implement the entire "tapping" mechanism in the least obstructing way.
Because entire messages are passed for external processing, range of possible applications is enormous.

I created PR (without prior issue), because change is small and a commit is worth a thousand words ;)

WireTap interface can be used to access all messages send and received
by Bitswap. This can be used to implement advanced statistics/analysis
logic, which is beyond scope of Bitswap, but can be implemented as IPFS
plugin.

Some examples of potential applications:
 - per CID bandwidth tracker (see: https://gitcoin.co/issue/PinataCloud/apollo/2/100023631)
 - detailed per peer stats
 - intrusion detection system (IDS) implementation
@welcome
Copy link

welcome bot commented Sep 21, 2020

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@dirkmc
Copy link
Contributor

dirkmc commented Sep 23, 2020

Hello, this PR looks good 👍

Could you please create a very simple test that just sends and receives a few messages between two nodes and verifies that MessageSent and MessageReceived are called correctly.

You can probably copy part of TestBasicBitswap

@tzdybal
Copy link
Contributor Author

tzdybal commented Sep 23, 2020

@dirkmc thanks for pointing me to TestBasicBitswap - it was great starting point.
I created a simple test showing that messages are wiretapped correctly.

Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! 👍

@dirkmc dirkmc merged commit bc3df6b into ipfs:master Sep 24, 2020
@aschmahmann
Copy link
Contributor

aschmahmann commented Nov 10, 2020

It looks like this PR's tests are causing data races (i.e. go test -race fails on TestWireTap). @dirkmc @tzdybal do you mind taking a look?

@Stebalien
Copy link
Member

It looks like the tests never ran. I wonder if CircleCI doesn't run for users without commit access?

@Stebalien
Copy link
Member

Fixed in #446.

@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants