p2p

package
v1.69.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: BSD-3-Clause Imports: 6 Imported by: 12

Documentation

Overview

Package p2p 实现多种类型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) (*queue.Message, 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

Directories

Path Synopsis
Package utils p2p utils
Package utils p2p utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL