messageswap

package module
v0.0.0-...-3ec4f1f Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 19 Imported by: 0

README

messageswap

messageswap is simple libp2p-based package for message swap in multi-peers setting

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadTimeout = fmt.Errorf("timed out reading response")

Functions

This section is empty.

Types

type Metaswap

type Metaswap interface {
	AddAddrToPeerstore(addr string) (peer.ID, error)
	SendMessage(ctx context.Context, pmes *pb.Message, peerID peer.ID) error
	SendRequest(ctx context.Context, pmes *pb.Message, peerID peer.ID) (*pb.Message, error)
}

func New

func New(host host.Host) (Metaswap, error)

New 新建一个消息发送网络的功能

type SwapImpl

type SwapImpl struct {
	Host host.Host
	// contains filtered or unexported fields
}

func (*SwapImpl) AddAddrToPeerstore

func (msnet *SwapImpl) AddAddrToPeerstore(addr string) (peer.ID, error)

func (*SwapImpl) NewMessageSender

func (msnet *SwapImpl) NewMessageSender(ctx context.Context, p peer.ID) (*messageSender, error)

func (*SwapImpl) SendMessage

func (msnet *SwapImpl) SendMessage(ctx context.Context, pmes *pb.Message, peerID peer.ID) error

func (*SwapImpl) SendRequest

func (msnet *SwapImpl) SendRequest(ctx context.Context, pmes *pb.Message, peerID peer.ID) (*pb.Message, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳