]> Sergey Matveev's repositories - btrtrc.git/blob - callbacks.go
Add the ReceiveEncryptedHandshakeSkeys callback
[btrtrc.git] / callbacks.go
1 package torrent
2
3 import (
4         "github.com/anacrolix/torrent/mse"
5         pp "github.com/anacrolix/torrent/peer_protocol"
6 )
7
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
13         // held.
14         CompletedHandshake    func(*PeerConn, InfoHash)
15         ReadMessage           func(*PeerConn, *pp.Message)
16         ReadExtendedHandshake func(*PeerConn, *pp.ExtendedHandshakeMessage)
17         PeerConnClosed        func(*PeerConn)
18
19         // Provides secret keys to be tried against incoming encrypted connections.
20         ReceiveEncryptedHandshakeSkeys mse.SecretKeyIter
21 }