Commit graph

98 commits

Author SHA1 Message Date
Jimmy Zelinskie
4b5e39f83c bittorrent: rename qp.Uint64 to qp.Uint 2022-01-17 15:54:56 -05:00
Jimmy Zelinskie
301dd22f15 lint: actually lint all go files 2022-01-15 23:28:52 -05:00
Jimmy Zelinskie
f3468edf19 frontend/http: avoid overflows parsing queryparams 2022-01-15 14:25:39 -05:00
Jimmy Zelinskie
d1b90c0139 lint: gofumpt files 2022-01-15 14:01:23 -05:00
Jimmy Zelinskie
b81a310eea bytepool: store *[]byte
This avoids allocations for the slice metadata.

For more details, see:
https://staticcheck.io/docs/checks#SA6002
2022-01-15 13:58:06 -05:00
Jimmy Zelinskie
65ce7c7c6b lint: lint files with golangci-lint 2022-01-15 13:31:14 -05:00
elotreum
77a52f9f30 http: allow for customized routes
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.
2020-01-14 16:35:28 -07:00
elotreum
5082146ae9 http: explicitly set Content-Type header
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.
2020-01-14 13:31:25 -07:00
Leo Balduf
87c72bc516 config: update example config 2019-10-17 12:38:08 +09:00
Leo Balduf
cb88a11d6a frontend: add defaults for parser options 2019-10-12 12:52:16 +09:00
Cenk Alti
d0fc3a4634
split listen&serve for http 2018-12-30 13:36:32 +03:00
Cenk Alti
0de1d25448
fix listenAndServe comment 2018-12-27 15:17:43 +03:00
Cenk Alti
b345eb3899
split listenAndServe into 2 functions 2018-12-26 18:15:05 +03:00
Cenk Alti
2a26215f2a
Revert "protect socket variable with mutex; fix #437"
This reverts commit 1b7ce4c378.
2018-12-26 18:10:48 +03:00
Cenk Alti
1b7ce4c378
protect socket variable with mutex; fix #437 2018-12-25 11:23:47 +03:00
Cenk Alti
fcbc168ae6
add test case for demonstrating panic 2018-12-25 11:23:08 +03:00
onestraw
e09d11e4b9 fix goimports error
Change-Id: I0f6e383ec1081cc47c690fdaab3fd35590a2634b
2018-12-17 16:59:44 +08:00
Jimmy Zelinskie
dcd8e8ea86
Merge pull request #429 from yashpal1995/canonicalize_real-ip-header
frontend/http: canonicalize http real_ip_header
2018-10-24 14:28:21 -04:00
Justin Li
3c80ed8a8e Fix goimports violations 2018-10-24 09:25:03 -04:00
Yashpal Choudhary
e749c9c6c9 frontend/http: canonicalize http real_ip_header
Fixes #428
2018-10-20 03:07:22 +05:30
Leo Balduf
495f2c2734 frontend/udp: pool connection ID generation state 2018-09-18 11:25:54 +02:00
Leo Balduf
96d0c3d829 frontend/udp: debug log connection ID generation/validation 2018-09-16 22:36:47 +02:00
Justin Li
1cb16ddb0c Add https_addr config, required to run HTTPS 2018-09-11 17:17:09 -04:00
Justin Li
1a4e4c833b
Merge pull request #413 from chihaya/recursive-stop-groups
Return []error from Stop() channel, allow recursive stop groups
2018-09-11 17:14:41 -04:00
Justin Li
d95120c817 Return []error from Stop() channel, allow recursive stop groups 2018-09-09 11:30:15 -04:00
Justin Li
20edf7a136 Add config to enable keepalive/persistent connections 2018-09-09 09:01:53 -04:00
Leo Balduf
8095657735 http: fix TLS 2018-09-04 12:45:06 +02:00
Jimmy Zelinskie
f0780ad9cc frontend: isolate prometheus logic to one file 2018-06-15 13:33:26 -04:00
Leo Balduf
fa19d1125c udp: support both BEP15 and old opentracker v6 announces 2018-02-17 13:41:36 +01:00
Jimmy Zelinskie
2004489016 *: add subtests for all table driven tests
Because we use testify, this is less useful than normal, but this is
still best practice for table-driven tests.
2017-12-29 17:44:45 -05:00
mrd0ll4r
15bd5c41f3
Merge pull request #368 from mrd0ll4r/udp-connect-af
udp: set address family for connect metrics
2017-12-07 19:10:30 +01:00
Leo Balduf
fa6e360da4 udp: set address family for connect metrics 2017-12-06 23:00:36 +01:00
Leo Balduf
2f58e98832 http: add option for legacy PHP URLs 2017-12-05 10:41:43 +01:00
Jimmy Zelinskie
80558648d7 Merge pull request #363 from jzelinskie/req-san
Request Sanitizer via library
2017-10-18 12:45:25 -04:00
Jimmy Zelinskie
df0de94337 frontend/http: bandwidth are in bytes not pieces 2017-10-18 11:51:19 -04:00
Jimmy Zelinskie
1a0b5c56a6 frontend/http: disambiguate NumWantProvided 2017-10-17 22:06:03 -04:00
Jimmy Zelinskie
ca823e0e5f frontend: update to use non-object sanization 2017-10-17 22:02:45 -04:00
mrd0ll4r
e7b8264e50 Merge pull request #361 from mrd0ll4r/timecache
Timecache: cache time
2017-10-15 21:47:05 +02:00
Leo Balduf
6dfdb7e192 udp: clean up connection ID generation 2017-10-15 20:05:39 +02:00
Leo Balduf
89bc479a3b *: make use of timecache 2017-10-15 20:05:39 +02:00
Jimmy Zelinskie
47b5e67345 frontend/udp: add request sanitization 2017-10-08 18:02:34 -04:00
Jimmy Zelinskie
6dee48ce17 frontend/http: add request sanitization 2017-10-08 18:02:33 -04:00
Leo Balduf
7d9166e003 http: add default ReadTimeout, WriteTimeout 2017-09-30 14:26:02 +02:00
Leo Balduf
8ed171b0ea pkg/log: create wrapper around logrus 2017-06-26 20:46:40 +02:00
Cedric Charly
f7becf952b frontend: TrackerLogic interface returns modified context
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
2017-06-07 19:25:12 -05:00
Leo Balduf
f61e7a9281 frontend: make request timing optional 2017-05-12 20:27:31 +02:00
Jimmy Zelinskie
cb55019ab8 *: add structured logging 2017-05-07 04:30:22 -04:00
Jimmy Zelinskie
ea0dba3a3d cmd/chihaya: refactor root run command
This change refactors a bunch of the state of execution into its own
object. It also attempts to simplify stopping and adjusts some other
packages to integrate with the stopper interface.

Fixes #309.
2017-05-01 15:56:38 -04:00
tom
cdb0ff3612 http: make numWant optional
The default numwant value should be used if either numwant is zero or omitted from the announce request.
2017-04-21 13:17:58 +01:00
Leo Balduf
2e625af44d http: fix HTTP shutdown panicking 2017-04-04 22:34:53 +02:00