p2p

package
Version: v6.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

package manage 实现多种类型p2p兼容管理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterP2PCreate

func RegisterP2PCreate(p2pType string, create CreateP2P)

RegisterP2PCreate register p2p create func

Types

type CreateP2P

type CreateP2P func(mgr *Manager, subCfg []byte) IP2P

CreateP2P p2p creator

func LoadP2PCreate

func LoadP2PCreate(p2pType string) CreateP2P

LoadP2PCreate load p2p create func

type IP2P

type IP2P interface {
	StartP2P()
	CloseP2P()
}

IP2P p2p interface

type Manager

type Manager struct {
	SysAPI   client.QueueProtocolAPI
	Client   queue.Client
	ChainCfg *types.Chain33Config
	PubSub   *pubsub.PubSub
	// contains filtered or unexported fields
}

Manager p2p manager

func NewP2PMgr

func NewP2PMgr(cfg *types.Chain33Config) *Manager

NewP2PMgr new p2p manager

func (*Manager) Close

func (mgr *Manager) Close()

Close close p2p

func (*Manager) PubBroadCast

func (mgr *Manager) PubBroadCast(hash string, data interface{}, eventTy int) error

PubBroadCast 兼容多种类型p2p广播消息, 避免重复接交易或者区块

func (*Manager) SetQueueClient

func (mgr *Manager) SetQueueClient(cli queue.Client)

SetQueueClient set the queue

func (*Manager) Wait

func (mgr *Manager) Wait()

Wait wait p2p

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL