func NewP2PMgr(cfg *types.Chain33Config) *Manager {
	mgr := &Manager{
		PubSub: pubsub.NewPubSub(1024),
	}
	var err error
	mgr.broadcastFilter, err = lru.New(10240)
	if err != nil {
		panic("NewP2PBasePanic, err=" + err.Error())
	}
	mgr.ChainCfg = cfg
	mgr.p2pCfg = cfg.GetModuleConfig().P2P
	if len(mgr.p2pCfg.Types) == 0 {
		panic("NewP2PBasePanic, Missing config p2p.types")
	}
	return mgr
}
NewP2PMgr new p2p manager
package p2p
import (
	"github.com/33cn/chain33/client"
	"github.com/33cn/chain33/common/pubsub"
	"github.com/33cn/chain33/queue"
	"github.com/33cn/chain33/types"
	lru "github.com/hashicorp/golang-lru"
)
type IP2P interface {
	StartP2P()
	CloseP2P()
}
type Manager struct {
	SysAPI   client.QueueProtocolAPI
	Client   queue.Client
	ChainCfg *types.Chain33Config
	PubSub   *pubsub.PubSub
	broadcastFilter *lru.Cache
	p2ps            []IP2P
	p2pCfg          *types.P2P
}
type CreateP2P func(mgr *Manager, subCfg []byte) IP2P
var (
	p2pRegTypes = make(map[string]CreateP2P)
)
func RegisterP2PCreate(p2pType string, create CreateP2P) {
	if create == nil {
		panic("RegisterP2P, nil CreateP2P, p2pType = " + p2pType)
	}
	if _, ok := p2pRegTypes[p2pType]; ok {
		panic("RegisterP2P, duplicate, p2pType = " + p2pType)
	}
	p2pRegTypes[p2pType] = create
}
func LoadP2PCreate(p2pType string) CreateP2P {
	if create, ok := p2pRegTypes[p2pType]; ok {
		return create
	}
	panic("LoadP2P, not exist, p2pType = " + p2pType)
}