github.com/anacrolix/torrent@v1.61.0/global.go (about)

     1  package torrent
     2  
     3  import (
     4  	"crypto"
     5  
     6  	pp "github.com/anacrolix/torrent/peer_protocol"
     7  )
     8  
     9  const (
    10  	pieceHash        = crypto.SHA1
    11  	defaultChunkSize = 0x4000 // 16KiB
    12  
    13  	// Arbitrary maximum of "metadata_size" (see https://www.bittorrent.org/beps/bep_0009.html)
    14  	// libtorrent-rasterbar uses 4MiB at last check. TODO: Add links to values used by other
    15  	// implementations here. I saw 14143527 in the metainfo for
    16  	// 3597f16e239aeb8f8524a1a1c4e4725a0a96b470. Large values for legitimate torrents should be
    17  	// recorded here for consideration.
    18  	maxMetadataSize uint32 = 16 * 1024 * 1024
    19  )
    20  
    21  func defaultPeerExtensionBytes() PeerExtensionBits {
    22  	return pp.NewPeerExtensionBytes(pp.ExtensionBitDht, pp.ExtensionBitLtep, pp.ExtensionBitFast)
    23  }