network

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StreamMutex sync.Mutex

流互斥锁

Functions

func SendDataToPeer

func SendDataToPeer(p2p *dep2p.DeP2P, pubsub *pubsub.DeP2PPubSub, protocol, topic, genre string, receiver peer.ID, data interface{}) error

SendDataToPeer 尝试先通过流发送数据,失败后通过订阅发送 protocol 协议 topic 主题 genre 类型 receiver 接收方ID data 内容

func SendPubSub

func SendPubSub(p2p *dep2p.DeP2P, pubsub *pubsub.DeP2PPubSub, topic, genre string, receiver peer.ID, data interface{}) error

SendPubSub 向指定的节点发送订阅消息 topic 主题 genre 类型 receiver 接收方ID data 内容

func SendStream

func SendStream(p2p *dep2p.DeP2P, protocol, genre string, receiver peer.ID, data interface{}) ([]byte, error)

SendStream 向指定的节点发流消息 protocol 协议 genre 类型 receiver 接收方ID data 内容

Types

This section is empty.

Jump to

Keyboard shortcuts

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