- // Updated occasionally to when there's been some changes to client
- // behaviour in case other clients are assuming anything of us. See also
- // `bep20`.
- extendedHandshakeClientVersion = "go.torrent dev 20150624"
- // Peer ID client identifier prefix. We'll update this occasionally to
- // reflect changes to client behaviour that other clients may depend on.
- // Also see `extendedHandshakeClientVersion`.
- bep20 = "-GT0001-"
-
- nominalDialTimeout = time.Second * 30
- minDialTimeout = 5 * time.Second
-
- // Justification for set bits follows.
- //
- // Extension protocol ([5]|=0x10):
- // http://www.bittorrent.org/beps/bep_0010.html
- //
- // Fast Extension ([7]|=0x04):
- // http://bittorrent.org/beps/bep_0006.html.
- // Disabled until AllowedFast is implemented. TODO
- //
- // DHT ([7]|=1):
- // http://www.bittorrent.org/beps/bep_0005.html
- defaultExtensionBytes = "\x00\x00\x00\x00\x00\x10\x00\x01"
-
- defaultEstablishedConnsPerTorrent = 80
- defaultHalfOpenConnsPerTorrent = 80
- torrentPeersHighWater = 200
- torrentPeersLowWater = 50
-
- // Limit how long handshake can take. This is to reduce the lingering
- // impact of a few bad apples. 4s loses 1% of successful handshakes that
- // are obtained with 60s timeout, and 5% of unsuccessful handshakes.
- handshakesTimeout = 20 * time.Second
+ // 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
+)