Add option to select network interface for operations

This commit is contained in:
Sude 2024-11-15 19:31:40 +02:00
parent 97bb4d8923
commit d83ba7ff30
4 changed files with 11 additions and 0 deletions

View File

@ -222,6 +222,7 @@ struct CurlConfig
curl_off_t iDownloadRate;
long int iLowSpeedTimeout;
long int iLowSpeedTimeoutRate;
std::string sInterface;
};
class Config

View File

@ -292,6 +292,7 @@ int main(int argc, char *argv[])
("check-free-space", bpo::value<bool>(&Globals::globalConfig.dlConf.bFreeSpaceCheck)->zero_tokens()->default_value(false), "Check for available free space before starting download")
("no-fast-status-check", bpo::value<bool>(&bNoFastStatusCheck)->zero_tokens()->default_value(false), "Don't use fast status check.\nMakes --status much slower but able to catch corrupted files by calculating local file hash for all files.")
("trust-api-for-extras", bpo::value<bool>(&Globals::globalConfig.bTrustAPIForExtras)->zero_tokens()->default_value(false), "Trust API responses for extras to be correct.")
("interface", bpo::value<std::string>(&Globals::globalConfig.curlConf.sInterface)->default_value(""), "Perform operations using a specified network interface")
;
options_cli_no_cfg_hidden.add_options()

View File

@ -453,6 +453,9 @@ local file hash for all files.
.TP
\fB\-\-trust\-api\-for\-extras\fR
Trust API responses for extras to be correct.
.TP
\fB\-\-interface\fR arg
Perform operations using a specified network interface
.SS "Experimental:"
.TP
\fB\-\-galaxy\-install\fR arg

View File

@ -817,6 +817,12 @@ void Util::CurlHandleSetDefaultOptions(CURL* curlhandle, const CurlConfig& conf)
if (!conf.sCACertPath.empty())
curl_easy_setopt(curlhandle, CURLOPT_CAINFO, conf.sCACertPath.c_str());
if (!conf.sInterface.empty())
{
curl_easy_setopt(curlhandle, CURLOPT_DNS_INTERFACE, conf.sInterface.c_str());
curl_easy_setopt(curlhandle, CURLOPT_INTERFACE, conf.sInterface.c_str());
}
}
std::string Util::CurlHandleGetInfoString(CURL* curlhandle, CURLINFO info)