package p2p import ( pstore "gx/ipfs/QmZR2XWVVBCtbgBWnQhWk2xcQfaR3W8faQPriAiaaj7rsr/go-libp2p-peerstore" p2phost "gx/ipfs/Qmb8T6YBBsjYsVGfrihQLfCJveczZnneSBqBKkYEBWDjge/go-libp2p-host" peer "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer" ) // P2P structure holds information on currently running streams/listeners type P2P struct { Listeners ListenerRegistry Streams StreamRegistry identity peer.ID peerHost p2phost.Host peerstore pstore.Peerstore } // CheckProtoExists checks whether a proto handler is registered to // mux handler func (p2p *P2P) CheckProtoExists(proto string) bool { protos := p2p.peerHost.Mux().Protocols() for _, p := range protos { if p != proto { continue } return true } return false }