dnn

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ID protocol.ID = "/dnn/1.0.0"
View Source
const TYPE_NODELIST = "nodelist"

Variables

This section is empty.

Functions

func Connect

func Connect(
	node *host.Host, address string,
	logInfoHandler LogInfoFunc,
	logErrorHandler LogErrorFunc,
	addPeerToListHandler AddPeerToListFunc,
	removePeerFromListHandler RemovePeerFromListFunc,
) error

Types

type AddPeerToListFunc

type AddPeerToListFunc func(*peer.AddrInfo)

type DnnService

type DnnService struct {
	Host                      *host.Host
	LogInfoHandler            LogInfoFunc
	LogErrorHandler           LogErrorFunc
	AddPeerToListHandler      AddPeerToListFunc
	RemovePeerFromListHandler RemovePeerFromListFunc
}

func NewDnnService

func NewDnnService(
	h *host.Host,
	logInfoHandler LogInfoFunc,
	logErrorHandler LogErrorFunc,
	addPeerToListHandler AddPeerToListFunc,
	removePeerFromListHandler RemovePeerFromListFunc,
) (*DnnService, error)

func (*DnnService) StreamHandler

func (s *DnnService) StreamHandler(buff network.Stream)

type LogErrorFunc

type LogErrorFunc func(error)

type LogInfoFunc

type LogInfoFunc func(string, ...interface{})

type Message

type Message struct {

	// Type of message
	Type string `json:"type"`
	Data string `json:"data"`
}

type Node

type Node struct {
	Address string  `json:"address"`
	ID      peer.ID `json:"id"`
}

type NodeList

type NodeList struct {
	Nodes []Node `json:"nodes"`
}

type RemovePeerFromListFunc

type RemovePeerFromListFunc func(peer.ID)

Jump to

Keyboard shortcuts

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