package
0.0.0-20240524050450-f3d5c149358a
Repository: https://github.com/bufrr/net.git
Documentation: pkg.go.dev
# Functions
NewLocalNode creates a local node.
NewNode creates a node.
NewRemoteMessage creates a RemoteMessage with remote node rn and msg.
NewRemoteNode creates a remote node.
# Structs
BytesReceived is called when local node receive user-defined BYTES message.
ConnectionAccepted is called when a network connection is accepted.
LocalNode is a local node.
LocalNodeStarted is called right after local node starts listening and handling messages.
LocalNodeStopped is called right after local node stops listening and handling messages.
LocalNodeWillStart is called right before local node starts listening and handling messages.
LocalNodeWillStop is called right before local node stops listening and handling messages.
MessageEncoded is called when a protobuf.Message is encoded into bytes and is about to be sent to RemoteNode.
MessageWillDecode is called when bytes is received from a RemoteNode and is about to be decoded into protobuf.Message.
Node is a remote or local node.
RemoteMessage is the received msg from remote node.
RemoteNode is a remote node.
RemoteNodeConnected is called when a connection is established with a remote node, but the remote node id is typically nil, so it's not a good time to use the node yet, but can be used to stop the connection to remote node.
RemoteNodeDisconnected is called when connection to remote node is closed.
RemoteNodeReady is called when local node has received the node info from remote node and the remote node is ready to use.
WillConnectToNode is called before local node connect to a new remote node.