torrent/callbacks.go

22 lines
803 B
Go
Raw Normal View History

2020-07-15 04:00:47 +00:00
package torrent
import (
"github.com/anacrolix/torrent/mse"
2020-07-15 04:00:47 +00:00
pp "github.com/anacrolix/torrent/peer_protocol"
)
// 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.
2020-07-15 04:00:47 +00:00
type Callbacks struct {
// Called after a peer connection completes the BitTorrent handshake. The Client lock is not
// held.
CompletedHandshake func(*PeerConn, InfoHash)
2020-07-15 06:16:09 +00:00
ReadMessage func(*PeerConn, *pp.Message)
ReadExtendedHandshake func(*PeerConn, *pp.ExtendedHandshakeMessage)
2020-10-13 02:02:39 +00:00
PeerConnClosed func(*PeerConn)
// Provides secret keys to be tried against incoming encrypted connections.
ReceiveEncryptedHandshakeSkeys mse.SecretKeyIter
2020-07-15 04:00:47 +00:00
}