Commit Graph

91 Commits

Author SHA1 Message Date
Charles Kerr db38f9aa2c
fix: remove announce ipv4 ipv6 query params (#4502) 2022-12-31 13:13:59 -06:00
Charles Kerr 5ce503f1ab
refactor: udp_core constructor (#4469)
* refactor: udp_core constructor

* refactor: invert dependency between tr_session.publicAddress() and tr_globalIPv6()
2022-12-28 02:03:35 -06:00
Charles Kerr ab9e971903
refactor: tr_globalIPv6() returns a std::optional<tr_address> (#4464) 2022-12-25 07:55:51 -06:00
Charles Kerr 0a69685a4e
refactor: tr_address cleanup (#4338)
* refactor: move tr_tracker_http_announce() helper funcs into their own namespace

* refactor: move tr_globalIPv6() helper funcs into their own namespace

* refactor: move tr_address_is_valid_for_peers() helper funcs into their own namespace

* refactor: make tr_address_compare() a private method

* refactor: rename tr_address::isIPv4() to is_ipv4()

* refactor: use snake_case for tr_address methods

* refactor: make tr_address_is_valid_for_peers() a member function
2022-12-08 20:27:52 -06:00
Charles Kerr eeaefca6f3
refactor: UDP and TCP announces use same timeout interval (#4279)
* refactor: move announce, scrape timeout intervals into announcer-common.h

* refactor: udp and http announces, scrapes use same timeout vals
2022-11-29 19:38:53 -06:00
Charles Kerr 22d12aedc5
refactor: GTK favicon lookup improvements (#4278) 2022-11-29 18:09:32 -06:00
Charles Kerr f27c5fa0fa
refactor: make some local pointer vars pointer-to-const (#4262) 2022-11-28 09:45:39 -06:00
Charles Kerr 554ba06ae2
fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
Charles Kerr d27c4c59ce
refactor: incremental announcer refactor pt. 2 (#4214) 2022-11-18 23:00:25 -06:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Charles Kerr b32f3e0a24
refactor: add tr_address::toCompact() (#4014)
* refactor: add tr_address::toCompact()

* test: use the theory.org compact ipv4/6 examples in NetTest.compact4, NetTest.compact6

* refactor: add tr_address::toCompact()

* test: add toCompact, fromCompact tests

* refactor: add compact <--> sockaddr_storage conversion
2022-10-24 13:40:12 -05:00
Charles Kerr 4a359fd481
refactor: session private fields (#3961)
* refactor: make tr_session.private_peer_port a private field

chore: make tr_session.public_peer_port a private field

* refactor: make tr_session.web_ a private field

* refactor: make tr_session.lpd_ a private field

* refactor: make tr_session.bind_ipv4_ private

refactor: make tr_session.bind_ipv6_ private

* refactor: make tr_session.bandwidth_groups_ private; add const accessor

* refactor: make tr_session.port_forwarding_ private

* refactor: make tr_session.peerMgr private pt 1: add tr_session::addIncoming()

* refactor: make tr_session.peerMgr private pt 1: add tr_session::addTorrent()

* refactor: make tr_session.peer_mgr_ private

* refactor: make tr_session.setPeerPort() private
2022-10-13 21:25:02 -05:00
Charles Kerr 56e0a1bda8
chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
Charles Kerr 228efa16e3
refactor: tr_globalIPv6() returns a std::optional<in6_addr> (#3836) 2022-09-21 23:59:31 -05:00
Charles Kerr dd12fd010a
chore: iwyu headers (#3833) 2022-09-21 18:34:18 -05:00
Charles Kerr d17341d784
refactor: constify (#3780) 2022-09-06 12:52:58 -05:00
Dmitry Antipov 72a1696900
refactor: fix warning issued during LTO build (#3766)
Fix the following warning emitted when using -flto with GCC 12.2.1:

libtransmission/announcer.cc:929:8: warning: type ‘struct announce_data’ violates the C++ One Definition Rule [-Wodr]
  929 | struct announce_data
      |        ^
libtransmission/announcer-http.cc:299:8: note: a different type is defined in another translation unit
  299 | struct announce_data
      |        ^
libtransmission/announcer.cc:931:15: note: the first difference of corresponding definitions is field ‘tier_id’
  931 |     int const tier_id;
      |               ^
libtransmission/announcer-http.cc:301:22: note: a field with different name is defined in another translation unit
  301 |     tr_sha1_digest_t info_hash;
      |

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-09-05 10:47:45 -05:00
Charles Kerr 3b692e1aa0
refactor: reduce http announce timeout interval to 45 seconds (#3745) 2022-09-01 15:11:51 -05:00
luzpaz f8203148f0
fix: fix various user facing and non-user facing typos (#3743)
* fix: fix various user facing and non-user facing typos

Found via `odespell -q 3 -S ./third-party,*.po,*.ts -L filetest,inout`
2022-08-31 11:28:54 -05:00
Charles Kerr a24679d89f
refactor: modernize-avoid-c-arrays pt. 2 (#3713) 2022-08-26 13:35:28 -05:00
Charles Kerr bbb1ba6ea3
refactor: tr_urlPercentEncode() (#3688) 2022-08-21 08:43:09 -05:00
Charles Kerr aac1ab784d
refactor: replace tr_http_escape() with tr_urlEscape() (#3678) 2022-08-19 14:33:06 -05:00
Charles Kerr 1cf19550ad Revert "refactor: use OutputIterator for url-escaped info hash strings (#3672)"
This reverts commit 479a16787e.
2022-08-19 02:18:16 -05:00
Charles Kerr 479a16787e
refactor: use OutputIterator for url-escaped info hash strings (#3672) 2022-08-18 14:49:20 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr 5c8695025a
refactor: make tr_session.is_closing_private_ (#3637) 2022-08-13 20:04:36 -05:00
Charles Kerr 18e2a04f88
refactor: make sha1, sha256 RAII safe (#3556) 2022-07-31 15:58:14 -05:00
Charles Kerr b889f0c395
chore: iwyu cstring, cstdlib, optional, unordered_set (#3532) 2022-07-27 16:53:39 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -05:00
Charles Kerr 1a0afbe95e
refactor: iwyu (#3525) 2022-07-25 21:45:54 -05:00
Charles Kerr d09aba0e6a
refactor: remove tr_address_from_string() (#3524)
use tr_address::fromString() instead

* refactor: use tr_address.isIPv4()
2022-07-25 17:25:55 -05:00
Viacheslav Chimishuk de7986e01d
Add announce-ip and announce-ip-enabled parameters. (#3461) 2022-07-20 14:04:52 -05:00
Charles Kerr 71bc7143b8
Revert "refactor: tr_address cleanup (#3422)" (#3426)
This reverts commit 9a44eeaa27.
2022-07-09 18:44:20 -05:00
Charles Kerr 9a44eeaa27
refactor: tr_address cleanup (#3422)
* refactor: remove tr_address_compare()

* refactor: remove tr_address_to_string()

* refactor: remove NUM_TR_AF_INET_TYPES

* refactor: replace tr_sessionGetPublicAddress with tr_session::getPublicAddress()

* refactor: tr_peerIo() takes tr_address by value

* refactor: replace tr_sessionIsAddressBlocked with tr_session::isAddressBlocked()

* refactor: tr_peerMgrAddIncoming now takes tr_address by value

* refactor: replace tr_address_is_valid_for_peers() with tr_address.isValidForPeers()

* refactor: tr_netOpenPeerSocket takes tr_address by value

* refactor: remove tr_generateAllowedSet()

* refactor: setup_sockaddr takes a tr_address by value

* refactor: tr_netBindTCP() takes a tr_address by value

* refactor: tr_dhtAddNode() takes a tr_address by value

* refactor: remove tr_address_from_string()

* refactor: rename tr_address.isValidForPeers() to .isValidPeerAddress()

* refactor: replace tr_address_from_sockaddr_storage() with tr_address::fromSockaddrStorage()

* refactor: minor cleanup to tr_address::readable()
2022-07-08 13:23:41 -05:00
Lucas Clemente Vella 42198afc5f
Implement latest version of BEP-7 for HTTP requests (#1661)
* Implement BEP-7 for HTTP announce (fixes #1659)
2022-06-17 20:33:11 -05:00
Charles Kerr 00386d03a6
fix: too-small scrape request packets may trip SYN flood detection (#3236)
Fixes #964.
2022-06-08 17:51:54 -05:00
Charles Kerr a25da4f376
refactor: add tr_address::fromCompact() (#2961) 2022-04-21 17:06:00 -05:00
Charles Kerr 32f854a7cf
refactor: add a tr_port safety class (#2952) 2022-04-21 10:58:13 -05:00
Charles Kerr e4461c48d7
refactor: prefer FMT_STRING (#2845)
* use FMT_STRING in libtr client on non-i18n strings

This gives compile-time safety checks.
2022-03-30 14:59:13 -05:00
Charles Kerr 2996e223dd
refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr 6cb0498486
fix: log unexpected announce/scrape keys (#2778)
Fixes #2765.
2022-03-17 19:31:24 -05:00
Charles Kerr fa8aaf7631
refactor: remove remaining vararg log messages (#2776) 2022-03-17 17:39:06 -05:00
Charles Kerr 0be920156b
refactor: fmt part 3 (#2773) 2022-03-15 19:51:36 -05:00
Charles Kerr a942c67199
refactor: use fmt (#2758)
* deps: use fmt (8.1.1 tag) to build log strings

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr d2f8e1d4e0
refactor: set logging levels (#2755) 2022-03-11 15:09:22 -06:00
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr cdd819772d
feat: tr_runInEventThread() now takes std::function, typesafe args (#2739) 2022-03-04 20:26:03 -08:00
Charles Kerr 9c3acc7e8a
fixup: handle unhandled scrape/announce responses (#2701)
followup to the #2531 benc refactor
2022-02-24 07:59:58 -06:00
Charles Kerr 29af76d977
refactor: tr_web (#2640)
* fixup! refactor: tr_web (#2633)

fix: race condition in web threadfunc during bootstrap

fixes #2639
2022-02-17 17:35:57 -06:00
Charles Kerr f1a53840f9
refactor: tr_web (#2633)
* refactor: fix tr_web rate limiting and dns caching
2022-02-16 12:33:50 -06:00