libp2pserver

package
v0.0.0-...-403c8b4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleError

func HandleError(err error, reqType string) *v0.Error

Types

type Handler

type Handler interface {
	HandleMessage(ctx context.Context, msgPeer peer.ID, msgbytes []byte) (proto.Message, error)
	ProtocolID() protocol.ID
}

type Server

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

Server handles client requests over libp2p

func New

func New(ctx context.Context, h host.Host, messageHandler Handler) *Server

New creates a new libp2p Server

func (*Server) ID

func (s *Server) ID() peer.ID

ID returns the peer.ID of the protocol server.

Jump to

Keyboard shortcuts

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