mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
chore: rename other publicAddress() functions (#5873)
This commit is contained in:
@@ -299,7 +299,7 @@ std::optional<std::string_view> tr_session::WebMediator::userAgent() const
|
|||||||
return TR_NAME "/" SHORT_VERSION_STRING;
|
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())
|
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;
|
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())
|
if (auto const addr = session_->bind_address(TR_AF_INET6); !addr.is_any())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -236,8 +236,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::optional<std::string> cookieFile() const override;
|
[[nodiscard]] std::optional<std::string> cookieFile() const override;
|
||||||
[[nodiscard]] std::optional<std::string> publicAddressV4() const override;
|
[[nodiscard]] std::optional<std::string> bind_address_V4() const override;
|
||||||
[[nodiscard]] std::optional<std::string> publicAddressV6() const override;
|
[[nodiscard]] std::optional<std::string> bind_address_V6() const override;
|
||||||
[[nodiscard]] std::optional<std::string_view> userAgent() 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]] size_t clamp(int torrent_id, size_t byte_count) const override;
|
||||||
[[nodiscard]] time_t now() const override;
|
[[nodiscard]] time_t now() const override;
|
||||||
|
|||||||
@@ -310,19 +310,19 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto publicAddress() const
|
[[nodiscard]] auto bind_address() const
|
||||||
{
|
{
|
||||||
switch (options.ip_proto)
|
switch (options.ip_proto)
|
||||||
{
|
{
|
||||||
case FetchOptions::IPProtocol::V4:
|
case FetchOptions::IPProtocol::V4:
|
||||||
return impl.mediator.publicAddressV4();
|
return impl.mediator.bind_address_V4();
|
||||||
case FetchOptions::IPProtocol::V6:
|
case FetchOptions::IPProtocol::V6:
|
||||||
return impl.mediator.publicAddressV6();
|
return impl.mediator.bind_address_V6();
|
||||||
default:
|
default:
|
||||||
auto ip = impl.mediator.publicAddressV4();
|
auto ip = impl.mediator.bind_address_V4();
|
||||||
if (ip == std::nullopt)
|
if (ip == std::nullopt)
|
||||||
{
|
{
|
||||||
ip = impl.mediator.publicAddressV6();
|
ip = impl.mediator.bind_address_V6();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ip;
|
return ip;
|
||||||
@@ -571,7 +571,7 @@ public:
|
|||||||
(void)curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, &tr_web::Impl::onDataReceived);
|
(void)curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, &tr_web::Impl::onDataReceived);
|
||||||
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, MaxRedirects);
|
(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());
|
(void)curl_easy_setopt(e, CURLOPT_INTERFACE, addrstr->c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return IPv4 user public address string, or nullopt to not use one
|
// 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 std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return IPv6 user public address string, or nullopt to not use one
|
// 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;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user