* replace bencode calls in http response with static generated values
* move bytepool to shared folder
* change receivers for `Scrapes` and `RequestAddresses` (bored of compile warnings)
Might be used when tracker is behind reverse proxy and one of provided
addresses in `real_ip_header` is private/local address.
Additional changes:
* check if provided address is not multicast/broadcast
* configure `http.Server.ReadHeaderTimeout` with `http.ReadTimeout` to mitigate Slowloris
* update dependencies
* minor docs fixes
SO_REUSEPORT allows multipple instances to use same port.
It might be used for better scalability and performance.
* update dependencies
* fix data race of http's srv and tlsSrv variables
* add multiple addresses in request structures and frontend parsers
* move per-ip peer fetch/store from storage to internal hooks
* fetch/store both v1 and v2 info hashes
* remove peer argument from scrape swarm storage call
* replace Peer field with netip.Addr in ScrapeRequest
* add man for keydb storage
* update readme
* delete info hash count key from redis (replaced with SCARD on infohash set)
* add GC test
* add peer.Addr() functio to always return unwrapped address if 4to6 appear
Update to allow arrays of routes to be passed to the http frontend.
This also supports named parameters as permitted by the
router.
To avoid external dependencies in the middleware, a RouteParam and
RouteParams type was added to the bittorrent package.
Note: this eliminates the need for "enable_legacy_php_urls", as
the the additional route could be added to the route array. However,
this may be considered a breaking change.
Since Content-Type is not explicitly set, golang sniffs the responses
and attempts a guess. With announce responses, this usually means it
guesses application/octet-stream.
According to the godoc at
https://golang.org/pkg/net/http/#ResponseWriter
// If WriteHeader has not yet been called, Write calls
// WriteHeader(http.StatusOK) before writing the data. If the Header
// does not contain a Content-Type line, Write adds a Content-Type set
// to the result of passing the initial 512 bytes of written data to
// DetectContentType. Additionally, if the total size of all written
// data is under a few KB and there are no Flush calls, the
// Content-Length header is added automatically.
HandleAnnounce and HandleScrape must return the modified context changed
by the hooks. These contexts are passed to AfterAnnounce and AfterScrape
for further use.
Closes#304