Documentation ¶
Overview ¶
Package crypto implements BitTorrent protocol encryption.
Index ¶
- func ClientHandshake(c net.Conn, skey []byte, ia []byte, options *Options) (conn net.Conn, buf []byte, err error)
- func ServerHandshake(c net.Conn, head []byte, skeys [][]byte, options *Options) (conn net.Conn, skey []byte, ia []byte, err error)
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientHandshake ¶
func ClientHandshake(c net.Conn, skey []byte, ia []byte, options *Options) (conn net.Conn, buf []byte, err error)
ClientHandshake performs the client side of the BitTorrent protocol encryption handshake. It returns an encrypted connection and any cleartext that was received together with the handshake.
func ServerHandshake ¶
func ServerHandshake(c net.Conn, head []byte, skeys [][]byte, options *Options) (conn net.Conn, skey []byte, ia []byte, err error)
ServerHandshake performs the server side of the BitTorrent protocol encryption handshake. It returns an encrypted connection, the skey that was agreed upon (a torrent hash), and any cleartext that was included within the handshake.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is an encrypted connexion. It implements the net.Conn interface.
func (*Conn) RemoteAddr ¶
type Options ¶
type Options struct { AllowCryptoHandshake bool PreferCryptoHandshake bool ForceCryptoHandshake bool AllowEncryption bool PreferEncryption bool ForceEncryption bool }
Type Options defines a policy for encrypting torrents
func DefaultOptions ¶
DefaultOptions returns a policy for encrypting torrents.