4 "github.com/anacrolix/torrent/mse"
5 pp "github.com/anacrolix/torrent/peer_protocol"
8 // These are called synchronously, and do not pass ownership of arguments (do not expect to retain
9 // data after returning from the callback). The Client and other locks may still be held. nil
10 // functions are not called.
11 type Callbacks struct {
12 // Called after a peer connection completes the BitTorrent handshake. The Client lock is not
14 CompletedHandshake func(*PeerConn, InfoHash)
15 ReadMessage func(*PeerConn, *pp.Message)
16 ReadExtendedHandshake func(*PeerConn, *pp.ExtendedHandshakeMessage)
17 PeerConnClosed func(*PeerConn)
19 // Provides secret keys to be tried against incoming encrypted connections.
20 ReceiveEncryptedHandshakeSkeys mse.SecretKeyIter
22 ReceivedUsefulData []func(ReceivedUsefulDataEvent)
23 ReceivedRequested []func(PeerMessageEvent)
24 DeletedRequest []func(PeerRequestEvent)
25 SentRequest []func(PeerRequestEvent)
26 PeerClosed []func(*Peer)
30 type ReceivedUsefulDataEvent = PeerMessageEvent
32 type PeerMessageEvent struct {
37 type PeerRequestEvent struct {