1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00

chore: rename other publicAddress() functions (#5873)

This commit is contained in:
tearfur 2023-08-14 23:31:12 +08:00 committed by GitHub
parent 0c7992baa2
commit a88b353576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -299,7 +299,7 @@ std::optional<std::string_view> tr_session::WebMediator::userAgent() const
return TR_NAME "/" SHORT_VERSION_STRING;
}
std::optional<std::string> tr_session::WebMediator::publicAddressV4() const
std::optional<std::string> tr_session::WebMediator::bind_address_V4() const
{
if (auto const addr = session_->bind_address(TR_AF_INET); !addr.is_any())
{
@ -309,7 +309,7 @@ std::optional<std::string> tr_session::WebMediator::publicAddressV4() const
return std::nullopt;
}
std::optional<std::string> tr_session::WebMediator::publicAddressV6() const
std::optional<std::string> tr_session::WebMediator::bind_address_V6() const
{
if (auto const addr = session_->bind_address(TR_AF_INET6); !addr.is_any())
{

View file

@ -236,8 +236,8 @@ private:
}
[[nodiscard]] std::optional<std::string> cookieFile() const override;
[[nodiscard]] std::optional<std::string> publicAddressV4() const override;
[[nodiscard]] std::optional<std::string> publicAddressV6() const override;
[[nodiscard]] std::optional<std::string> bind_address_V4() const override;
[[nodiscard]] std::optional<std::string> bind_address_V6() const override;
[[nodiscard]] std::optional<std::string_view> userAgent() const override;
[[nodiscard]] size_t clamp(int torrent_id, size_t byte_count) const override;
[[nodiscard]] time_t now() const override;

View file

@ -310,19 +310,19 @@ public:
}
}
[[nodiscard]] auto publicAddress() const
[[nodiscard]] auto bind_address() const
{
switch (options.ip_proto)
{
case FetchOptions::IPProtocol::V4:
return impl.mediator.publicAddressV4();
return impl.mediator.bind_address_V4();
case FetchOptions::IPProtocol::V6:
return impl.mediator.publicAddressV6();
return impl.mediator.bind_address_V6();
default:
auto ip = impl.mediator.publicAddressV4();
auto ip = impl.mediator.bind_address_V4();
if (ip == std::nullopt)
{
ip = impl.mediator.publicAddressV6();
ip = impl.mediator.bind_address_V6();
}
return ip;
@ -571,7 +571,7 @@ public:
(void)curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, &tr_web::Impl::onDataReceived);
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, MaxRedirects);
if (auto const addrstr = task.publicAddress(); addrstr)
if (auto const addrstr = task.bind_address(); addrstr)
{
(void)curl_easy_setopt(e, CURLOPT_INTERFACE, addrstr->c_str());
}

View file

@ -123,13 +123,13 @@ public:
}
// Return IPv4 user public address string, or nullopt to not use one
[[nodiscard]] virtual std::optional<std::string> publicAddressV4() const
[[nodiscard]] virtual std::optional<std::string> bind_address_V4() const
{
return std::nullopt;
}
// Return IPv6 user public address string, or nullopt to not use one
[[nodiscard]] virtual std::optional<std::string> publicAddressV6() const
[[nodiscard]] virtual std::optional<std::string> bind_address_V6() const
{
return std::nullopt;
}