package bitswap import ( bsmsg "gitlab.dms3.io/dms3/go-bitswap/message" peer "gitlab.dms3.io/p2p/go-p2p-core/peer" ) // WireTap provides methods to access all messages sent and received by Bitswap. // This interface can be used to implement various statistics (this is original intent). type WireTap interface { MessageReceived(peer.ID, bsmsg.BitSwapMessage) MessageSent(peer.ID, bsmsg.BitSwapMessage) } // Configures Bitswap to use given wiretap. func EnableWireTap(tap WireTap) Option { return func(bs *Bitswap) { bs.wiretap = tap } } // Configures Bitswap not to use any wiretap. func DisableWireTap() Option { return func(bs *Bitswap) { bs.wiretap = nil } }