]> Sergey Matveev's repositories - btrtrc.git/blobdiff - global.go
Drop support for go 1.20
[btrtrc.git] / global.go
index 1a09b06e6b4d6dbd96cd018a6522721429af593b..5a5bddba0a6b3acfebea35d8f21d908a38ce3be0 100644 (file)
--- a/global.go
+++ b/global.go
@@ -9,8 +9,14 @@ import (
 
 const (
        pieceHash        = crypto.SHA1
-       maxRequests      = 250    // Maximum pending requests we allow peers to send us.
        defaultChunkSize = 0x4000 // 16KiB
+
+       // Arbitrary maximum of "metadata_size" (see https://www.bittorrent.org/beps/bep_0009.html)
+       // libtorrent-rasterbar uses 4MiB at last check. TODO: Add links to values used by other
+       // implementations here. I saw 14143527 in the metainfo for
+       // 3597f16e239aeb8f8524a1a1c4e4725a0a96b470. Large values for legitimate torrents should be
+       // recorded here for consideration.
+       maxMetadataSize uint32 = 16 * 1024 * 1024
 )
 
 // These are our extended message IDs. Peers will use these values to
@@ -18,10 +24,11 @@ const (
 const (
        metadataExtendedId = iota + 1 // 0 is reserved for deleting keys
        pexExtendedId
+       utHolepunchExtendedId
 )
 
 func defaultPeerExtensionBytes() PeerExtensionBits {
-       return pp.NewPeerExtensionBytes(pp.ExtensionBitDHT, pp.ExtensionBitExtended, pp.ExtensionBitFast)
+       return pp.NewPeerExtensionBytes(pp.ExtensionBitDht, pp.ExtensionBitLtep, pp.ExtensionBitFast)
 }
 
 func init() {