rust-libp2p
rust-libp2p copied to clipboard
protocols/*: Use Protobuf Codec pattern
Instead of implementing Protobuf en-/decoding in each protocol and for each message exchange, one can instead implement a custom encoder abstracting the en-/decoding of Protobuf messages.
This is done for libp2p-dcutr in https://github.com/libp2p/rust-libp2p/pull/2438/commits/354900fd1eafa108d9f70f54ec5c15ae3527656b.
We should do the same for all protocols in /protocols/* that en-/decode Protobuf messages. Instead of a custom Codec in each, we can have a single shared one in libp2p-core.