Commit Graph

82 Commits

Author SHA1 Message Date
Lawrence, Rendall ef03291efe (tested) rollback to separate v4 and v6 keys in redis/keydb
* sanitize log fields
* remove miniredis dependency
* store/collect information about hybrid (v2to1) hashes
2022-04-24 20:32:15 +03:00
Lawrence, Rendall 3bc2276fb3 (tested) Refactor code
* merge 9d04e4c from https://github.com/jzelinskie/chihaya
* sanitize ip address on Scrape requests
* remove NewConnectionID and ValidConnectionID functions from production code
2022-04-21 21:57:18 +03:00
Lawrence, Rendall f9c72341c0 (minor) refactor redis GC and fix TX calls,
add indicator that metrics are running
2022-04-17 00:57:30 +03:00
Lawrence, Rendall 7716aa828a (minor) Merge commits 7a4c2ee..77b3bf9 from https://github.com/jzelinskie/chihaya 2022-04-16 21:24:35 +03:00
Lawrence, Rendall 8cd8343757 (tested) refactor code
* add sentinel master parameter into driver config
* replace yaml double deserialization with `mapstructure` in initializers
* replace struct initializers with registered functions
* add torrent approval MD and a sanitize rest MDs
2022-04-16 00:51:48 +03:00
Lawrence, Rendall 397e106396 (tested) fix redis to pass tests
* 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
2022-04-15 01:33:45 +03:00
Lawrence, Rendall 5c2471ca9b (untested) Merge commit e56ad81 from https://github.com/jzelinskie/chihaya
* rename/replace redis keys
2022-04-14 19:14:12 +03:00
Lawrence, Rendall 781fa9440f (done) replace redigo with go-redis
* replace redis keys with RawString encoded values (delete SerializedPeer)
* merge peers got from pre-hools with store data
2022-04-14 01:13:18 +03:00
Lawrence, Rendall c9e0af8b1e fix lint errors 2022-04-12 21:48:54 +03:00
Lawrence, Rendall 64eaf9d733 Fix lint gosec and ifshort issues 2022-04-12 18:51:03 +03:00
Lawrence, Rendall c1956d68f6 Remove YAML/MD lint configs, reformat stdlib imports 2022-04-12 18:10:51 +03:00
Širhoe Biazhkovič c7edbb52f2 Merge commits 129aac230aa..828edb8fd8b from https://github.com/chihaya/chihaya 2022-04-12 15:58:14 +03:00
Lawrence, Rendall fa4c7c49ad Add ping route for http listener 2021-12-21 16:36:38 +03:00
Lawrence, Rendall 4dbbb4ad83 Rename to MoChi 2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič 0a5ac35c4d Fix e2e execution, append 2to1 hash in approvals, update dependencies 2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič dd0a455a4a Fix invalid http frontend listen call 2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič 239a642bfc Fix varinterval panic if request IH is not provided 2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič beb4736b86 Implement simple PGDC methods for storage
* sanitize code a little
* move e2e build to 'e2e' tag
2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič 566d99fcd7 Gegin work on shared store for handlers 2021-12-21 15:24:25 +03:00
Širhoe Biazhkovič 2f092bad45 Initial torrentV2 hash support 2021-12-21 15:24:11 +03:00
Širhoe Biazhkovič 114e8c0f06 Fix invalid time serialization 2021-09-05 18:16:10 +03:00
Širhoe Biazhkovič cb4ac3c7f8 Remove zeebo/bencode dependency because of anacrolix/torrent usage 2021-09-05 16:17:21 +03:00
Širhoe Biazhkovič 8580bb37e0 WIP Add support for custom torrents' approval storages
* migrate torrentapproval to list storage
* add initial support for torrent file storage (watch directory with fsnotify)
* replace frontend/http/bencode package with github.com/zeebo/bencode module
* sanitize code (fix warnings)

TODO:
* parse torrent files to get hashes,
* watch directory event types

DON'T use for now
2021-09-04 01:49:01 +03: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
Yashpal Choudhary e749c9c6c9 frontend/http: canonicalize http real_ip_header
Fixes #428
2018-10-20 03:07:22 +05:30
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
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
Leo Balduf 2f58e98832 http: add option for legacy PHP URLs 2017-12-05 10:41:43 +01: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
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
Leo Balduf 300b9c12ab http: use go1.8 graceful shutdown 2017-02-18 13:08:12 +01:00