]> Sergey Matveev's repositories - btrtrc.git/blobdiff - callbacks.go
Add the ReceiveEncryptedHandshakeSkeys callback
[btrtrc.git] / callbacks.go
index 83e248154a9d4c7878dc96c6e38f0ae0f9d8860d..fa9fea5bea3d3c824ee04467da51c1ee781453b8 100644 (file)
@@ -1,14 +1,21 @@
 package torrent
 
 import (
+       "github.com/anacrolix/torrent/mse"
        pp "github.com/anacrolix/torrent/peer_protocol"
 )
 
-// These are called synchronously, and do not pass ownership. The Client and other locks may still
-// be held. nil functions are not called.
+// These are called synchronously, and do not pass ownership of arguments (do not expect to retain
+// data after returning from the callback). The Client and other locks may still be held. nil
+// functions are not called.
 type Callbacks struct {
-       CompletedHandshake    func(_ *PeerConn, infoHash InfoHash)
+       // Called after a peer connection completes the BitTorrent handshake. The Client lock is not
+       // held.
+       CompletedHandshake    func(*PeerConn, InfoHash)
        ReadMessage           func(*PeerConn, *pp.Message)
        ReadExtendedHandshake func(*PeerConn, *pp.ExtendedHandshakeMessage)
        PeerConnClosed        func(*PeerConn)
+
+       // Provides secret keys to be tried against incoming encrypted connections.
+       ReceiveEncryptedHandshakeSkeys mse.SecretKeyIter
 }