Consume Void::Net directly in NetworkClient and callers
Delete NetworkClient's to_void_method/to_void_proxy/to_api_response bridge and the Api::RetryConfig member; the client builds Void::Net::Request, sends via Void::Net::HttpClient, returns Void::Net::Response, and retries via an internal Void::Retry policy + retryable-status list. Call sites updated to Void::Net member names: isSuccess()->ok(), statusCode->status, getHeader()->header() (optional<string_view>), isRedirect()->status range check; proxy isValid()->enabled(), requiresAuth()->has_auth(), isSocks5()->kind == Kind::Socks5. Proxy fields flow through YtDlpManager/AudioDecoder/MusicManager unchanged in spelling. On-disk proxy shape is now Void::Net::ProxyConfig (kind: None/Http/Socks5); config.example.json updated and proxy round-trip verified. Build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
3af9aecbec
commit
9d56a6ff01
12 files changed
+158
-223
No files matched your search
@@ -32,11 +32,11 @@ namespace Echoion::Core
|
||||
|
||||
// NetworkClient is already initialized by Core, just update proxy if
|
||||
// needed
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->isValid()) {
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->enabled()) {
|
||||
networkClient_->setProxy(networkConfig.proxy);
|
||||
ECHOION_LOG_INFO(std::format(
|
||||
"NetworkClient using {} proxy: {}:{}",
|
||||
networkConfig.proxy->isSocks5() ? "SOCKS5" : "HTTP",
|
||||
(networkConfig.proxy->kind == Void::Net::ProxyConfig::Kind::Socks5) ? "SOCKS5" : "HTTP",
|
||||
networkConfig.proxy->host, networkConfig.proxy->port));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Echoion::Core
|
||||
}
|
||||
|
||||
// Configure proxy for YouTube client
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->isValid()) {
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->enabled()) {
|
||||
youTubeClient_->setProxyConfig(networkConfig.proxy);
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ namespace Echoion::Core
|
||||
TEAMSPEAK_CHANNELS);
|
||||
|
||||
// Set proxy config from NetworkConfig if enabled
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->isValid()) {
|
||||
if (networkConfig.proxy.has_value() && networkConfig.proxy->enabled()) {
|
||||
audioDecoder_->setProxyConfig(networkConfig.proxy);
|
||||
ECHOION_LOG_INFO(
|
||||
std::format("AudioDecoder using {} proxy: {}:{}",
|
||||
networkConfig.proxy->isSocks5() ? "SOCKS5" : "HTTP",
|
||||
(networkConfig.proxy->kind == Void::Net::ProxyConfig::Kind::Socks5) ? "SOCKS5" : "HTTP",
|
||||
networkConfig.proxy->host,
|
||||
networkConfig.proxy->port));
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace Echoion::Core
|
||||
// proxy
|
||||
const auto& networkConfig = ECHOION_NETWORK;
|
||||
if (!openResult && networkConfig.proxy.has_value() &&
|
||||
networkConfig.proxy->isValid()) {
|
||||
networkConfig.proxy->enabled()) {
|
||||
ECHOION_LOG_INFO(
|
||||
"Direct open failed, trying download through proxy...");
|
||||
auto downloadedPath = downloadAudioForPlayback(*streamUrl);
|
||||
@@ -2263,10 +2263,10 @@ Subscriptions are persistent across server reconnects.)";
|
||||
response.error().message));
|
||||
}
|
||||
|
||||
if (response->statusCode != 200) {
|
||||
if (response->status != 200) {
|
||||
return Api::fail(
|
||||
Api::ErrorCode::NetworkError,
|
||||
std::format("HTTP error {}: {}", response->statusCode,
|
||||
std::format("HTTP error {}: {}", response->status,
|
||||
response->body.substr(0, 100)));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user