forked from perlin-network/noise
-
Notifications
You must be signed in to change notification settings - Fork 1
/
callbacks.go
21 lines (14 loc) · 1019 Bytes
/
callbacks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package noise
import "github.com/cynthiatong/noise/payload"
type OnErrorCallback func(node *Node, err error) error
type OnPeerErrorCallback func(node *Node, peer *Peer, err error) error
type OnPeerDisconnectCallback func(node *Node, peer *Peer) error
type OnPeerInitCallback func(node *Node, peer *Peer) error
type BeforeMessageSentCallback func(node *Node, peer *Peer, msg []byte) ([]byte, error)
type BeforeMessageReceivedCallback func(node *Node, peer *Peer, msg []byte) ([]byte, error)
type AfterMessageSentCallback func(node *Node, peer *Peer) error
type AfterMessageReceivedCallback func(node *Node, peer *Peer) error
type AfterMessageEncodedCallback func(node *Node, peer *Peer, header, msg []byte) ([]byte, error)
type OnPeerDecodeHeaderCallback func(node *Node, peer *Peer, reader payload.Reader) error
type OnPeerDecodeFooterCallback func(node *Node, peer *Peer, msg []byte, reader payload.Reader) error
type OnMessageReceivedCallback func(node *Node, opcode Opcode, peer *Peer, message Message) error