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
Click to show internal directories.
Click to hide internal directories.