server

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

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

type Message

type Message interface {
	service.DirectMessage
	Data() service.Data
}

type MessageServer

type MessageServer struct {
	log.Log
	ReqId uint64 //request id
	// contains filtered or unexported fields
}

func NewMsgServer

func NewMsgServer(network Service, name string, requestLifetime time.Duration, c chan service.DirectMessage, logger log.Log) *MessageServer

func (*MessageServer) Close

func (p *MessageServer) Close()

func (*MessageServer) RegisterBytesMsgHandler

func (p *MessageServer) RegisterBytesMsgHandler(msgType MessageType, reqHandler func([]byte) []byte)

func (*MessageServer) RegisterMsgHandler

func (p *MessageServer) RegisterMsgHandler(msgType MessageType, reqHandler func(message Message) []byte)

func (*MessageServer) SendRequest

func (p *MessageServer) SendRequest(msgType MessageType, payload []byte, address p2pcrypto.PublicKey, resHandler func(msg []byte)) error

type MessageType

type MessageType uint32

type Service

type Service interface {
	RegisterDirectProtocolWithChannel(protocol string, ingressChannel chan service.DirectMessage) chan service.DirectMessage
	SendWrappedMessage(nodeID p2pcrypto.PublicKey, protocol string, payload *service.DataMsgWrapper) error
}

Jump to

Keyboard shortcuts

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