network

package
v0.0.0-...-3442dc8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Network

type Network interface {
	ID() string

	ListenAddr() []string

	Connect(listenAddr []string) error

	Send(ctx context.Context, protocolID string, moduleName string, data []byte) error

	SendWithResponse(ctx context.Context, protocolID string, moduleName string, data []byte) ([]message.SendResponse, error)

	Subscribe(ctx context.Context, topic string, localIgnore bool, validators ...message.PubSubMessageValidator) error

	UnSubscribe(topic string) error

	Publish(ctx context.Context, toModuleNames []string, topic string, data []byte) error

	CreateTopic(topic string)

	RegisterModule(moduleName string, pid *actor.PID, marshaler codec.Marshaler)

	UnRegisterModule(moduleName string, pid *actor.PID, marshaler codec.Marshaler)

	UpdateNetActiveNode(netActiveNode tpnetcmn.NetworkActiveNode)

	ConnectedPeers() []*tpnetcmn.RemotePeer

	Connectedness(nodeID string) (tpnetcmn.Connectedness, error)

	PubSubScores() []tpnetcmn.PubsubScore

	NatState() (*tpnetcmn.NatInfo, error)

	PeerDetailInfo(nodeID string) (*tpnetcmn.PeerDetail, error)

	FindPeer(ctx context.Context, nodeID string) (string, error)

	ConnectToNode(ctx context.Context, nodeNetAddr string) error

	DisConnectWithNode(nodeID string) error

	Start()

	Ready() bool

	Stop()
}

func NewNetwork

func NewNetwork(ctx context.Context, log tplog.Logger, config *configuration.NetworkConfiguration, sysActor *actor.ActorSystem, endPoint string, seed string, netActiveNode tpnetcmn.NetworkActiveNode) Network

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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