79 Commits

Author SHA1 Message Date
Lawrence, Rendall d9666685f5 update Go verstion to 1.25
* update dependencies
* fix lint warnings (package naming, ctx cancel, UDP serve close check)
2026-03-24 19:36:49 +03:00
Lawrence, Rendall 08686d74b7 update dependencies and fix lint warnings 2026-02-18 18:12:58 +03:00
Lawrence, Rendall 5513f1357d fix lint warnings
replace naked returns with arguments (gofumpt@v0.9.1)
2025-09-22 17:11:05 +03:00
Lawrence, Rendall 1a3f5b1598 upgrade golangci to v2
* migrate configuration to version 2
* fix new lint warnings
* update lint.yaml to use golangci-lint-action v7
2025-04-22 14:18:18 +03:00
Lawrence, Rendall 1a243b94c5 (minor) unify log keys 2024-03-12 15:29:58 +03:00
Lawrence, Rendall 665899017e (untested) move unsafe string conversion to pkg
* fix invalid UDP f/e start when no workers provided
* add bench for entire server
2023-03-22 17:51:13 +03:00
Lawrence, Rendall 88f1ef7ca5 suppress context canceled error 2023-03-19 19:52:52 +03:00
Lawrence, Rendall 34c2921be8 add support for no_peer_id HTTP announce parameter
* remove `compact` from req/resp structures, because
it used only in HTTP and only while response write
2023-03-19 18:37:57 +03:00
Lawrence, Rendall da7de52813 change httprouter with fasthttp and simple handler
* add http benchmark
* move HTTP query parameters parsing to http subpackage
* update dependencies
2023-03-18 00:58:35 +03:00
Lawrence, Rendall 234c65333e Add workers config parameter to start concurrent listeners 2022-11-25 13:58:04 +03:00
Lawrence, Rendall ef6d820c5b Add cmd option for quick start w/o config file 2022-11-18 18:28:19 +03:00
Lawrence, Rendall d8d6f2cf4b refactor code for context fallthrough 2022-11-01 17:02:24 +03:00
Lawrence, Rendall d6de38bdbd (wip) pass context from frontend request down to store 2022-10-31 18:57:57 +03:00
Lawrence, Rendall 352c09031b fix http double close
* fix docs and examples
2022-10-27 03:39:14 +03:00
Lawrence, Rendall c1e041b4f8 (wip) fix invalid http compact address encode
* add packages to loggers
* split config examples with different storages
2022-10-25 18:38:55 +03:00
Lawrence, Rendall a9d1642615 (wip) sanitize and refactor code
* 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)
2022-10-24 19:07:47 +03:00
Lawrence, Rendall dff0ba6da8 (wip) rework configuration to support multiple frontends 2022-10-21 17:53:03 +03:00
Lawrence, Rendall 96653c45a3 add filter_private_ips option to discard private IPs.
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
2022-07-23 15:49:22 +03:00
Lawrence, Rendall 9d8440667c (tested) Add reuseport feauture.
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
2022-07-11 13:38:37 +03:00
Lawrence, Rendall 73d8922c74 (partially tested) add pg storage configuration and man
* update test query for `pg`
* attach `pg` to supported storages
* fix lint warnings
* update dependencies
2022-06-21 18:01:08 +03:00
Lawrence, Rendall 79c92df0f8 (tested) add hooks check when ping http route called 2022-05-14 01:36:21 +03:00
Lawrence, Rendall c50a532181 (tested) complete replace logrus with zerolog
* remove cobra dependency and split execs to mochi and e2e

* add log init synchronization
2022-05-02 03:13:58 +03:00
Lawrence, Rendall 4d646f7c09 (wip) migrate to zerolog 2022-05-01 01:39:21 +03:00
Lawrence, Rendall 64b27c2df6 (tested) preserve all addresses of peer
* 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
2022-04-27 00:52:17 +03:00
Lawrence, Rendall b365abd296 (untested) sanitize code
* remove peer argument from scrape swarm storage call

* replace Peer field with netip.Addr in ScrapeRequest

* add man for keydb storage

* update readme
2022-04-25 19:05:41 +03:00
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 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 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 64eaf9d733 Fix lint gosec and ifshort issues 2022-04-12 18:51:03 +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č 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č 2f092bad45 Initial torrentV2 hash support 2021-12-21 15:24:11 +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 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
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 2f58e98832 http: add option for legacy PHP URLs 2017-12-05 10:41:43 +01:00
Jimmy Zelinskie ca823e0e5f frontend: update to use non-object sanization 2017-10-17 22:02:45 -04:00