Documentation ¶
Overview ¶
Package btconn provides support for dialing and accepting BitTorrent connections.
Index ¶
- func Accept(conn net.Conn, handshakeTimeout time.Duration, ...) (encConn net.Conn, cipher mse.CryptoMethod, peerExtensions [8]byte, ...)
- func Dial(addr net.Addr, dialTimeout, handshakeTimeout time.Duration, ...) (conn net.Conn, cipher mse.CryptoMethod, peerExtensions [8]byte, ...)
- type HandshakeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
func Accept( conn net.Conn, handshakeTimeout time.Duration, getSKey func(sKeyHash [20]byte) (sKey []byte), forceEncryption bool, hasInfoHash func([20]byte) bool, ourExtensions [8]byte, ourID [20]byte) ( encConn net.Conn, cipher mse.CryptoMethod, peerExtensions [8]byte, peerID [20]byte, infoHash [20]byte, err error)
Accept BitTorrent handshake from the connection. Handles encryption. Returns a new connection that is ready for sending/receiving BitTorrent protocol messages.
func Dial ¶
func Dial( addr net.Addr, dialTimeout, handshakeTimeout time.Duration, enableEncryption, forceEncryption bool, ourExtensions [8]byte, ih [20]byte, ourID [20]byte, stopC chan struct{}) ( conn net.Conn, cipher mse.CryptoMethod, peerExtensions [8]byte, peerID [20]byte, err error)
Dial new connection to the address. Does the BitTorrent protocol handshake. Handles encryption. May try to connect again if encryption does not match with given setting. Returns a net.Conn that is ready for sending/receiving BitTorrent peer protocol messages.
Types ¶
type HandshakeError ¶ added in v1.0.2
type HandshakeError struct {
// contains filtered or unexported fields
}
HandshakeError is an error while doing the protocol handshake.
func (*HandshakeError) Error ¶ added in v1.0.2
func (e *HandshakeError) Error() string
Click to show internal directories.
Click to hide internal directories.