handler

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddrInfo

func GetAddrInfo(peerId string) string

* 如果输入peerId没有地址信息,通过路由表获取完整的地址信息 如果不在路由表中则原样返回,这地方有个问题,定位器有地址信息,客户端没有地址信息

func GetPeerId

func GetPeerId(peerId string) string

func HandleRaw

func HandleRaw(data []byte, p *pipe.Pipe) ([]byte, error)

* libp2p的流处理模块把接收的数据分发到这里,通用的消息处理分发器根据stream的protocolID作下一步处理分发 比如,chain协议的将进一步分发到p2p的chain协议处理handler

func ProtocolStream

func ProtocolStream(protocolID protocol.ID)

* 根据配置的协议编号自定义流协议,其他peer连接自己的时候,用于在节点间接收和发送数据

Types

type PipePool

type PipePool struct {
	// contains filtered or unexported fields
}

func GetPipePool

func GetPipePool() *PipePool

func (*PipePool) Close

func (this *PipePool) Close(peerId string, protocolId string, connectSessionId string, streamId string)

func (*PipePool) CreatePipe

func (this *PipePool) CreatePipe(stream network.Stream, direct string) *pipe.Pipe

func (*PipePool) Disconnect

func (this *PipePool) Disconnect(peerId string, connectSessionId string)

func (*PipePool) GetRequestPipe

func (this *PipePool) GetRequestPipe(peerId string, protocolId string) *pipe.Pipe

* 主动发送消息获取管道,如果流不存在,创建一个

func (*PipePool) GetResponsePipe

func (this *PipePool) GetResponsePipe(peerId string, connectSessionId string) *pipe.Pipe

Jump to

Keyboard shortcuts

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