Added ipresolve option
This commit is contained in:
parent
31676f6201
commit
a5cdd05c25
|
@ -418,6 +418,12 @@ Username and passphrase are valid only for HTTP schema.
|
||||||
If the HTTP proxy does not require authentication, this option is not required.
|
If the HTTP proxy does not require authentication, this option is not required.
|
||||||
Separate the username and passphrase with a ':' character and specify each as a URL-encoded string.
|
Separate the username and passphrase with a ':' character and specify each as a URL-encoded string.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-o\fR ipresolve (default="whatever")
|
||||||
|
Select what type of IP addresses to use when establishing a connection.
|
||||||
|
Default('whatever') can use addresses of all IP versions(IPv4 and IPv6) that your system allows.
|
||||||
|
If you specify 'IPv4', only IPv4 addresses are used.
|
||||||
|
And when 'IPv6' is specified, only IPv6 addresses will be used.
|
||||||
|
.TP
|
||||||
\fB\-o\fR logfile - specify the log output file.
|
\fB\-o\fR logfile - specify the log output file.
|
||||||
s3fs outputs the log file to syslog. Alternatively, if s3fs is started with the "-f" option specified, the log will be output to the stdout/stderr.
|
s3fs outputs the log file to syslog. Alternatively, if s3fs is started with the "-f" option specified, the log will be output to the stdout/stderr.
|
||||||
You can use this option to specify the log file that s3fs outputs.
|
You can use this option to specify the log file that s3fs outputs.
|
||||||
|
|
24
src/curl.cpp
24
src/curl.cpp
|
@ -130,6 +130,7 @@ bool S3fsCurl::requester_pays = false; // default
|
||||||
std::string S3fsCurl::proxy_url;
|
std::string S3fsCurl::proxy_url;
|
||||||
bool S3fsCurl::proxy_http = false;
|
bool S3fsCurl::proxy_http = false;
|
||||||
std::string S3fsCurl::proxy_userpwd;
|
std::string S3fsCurl::proxy_userpwd;
|
||||||
|
long S3fsCurl::ipresolve_type = CURL_IPRESOLVE_WHATEVER;
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Class methods for S3fsCurl
|
// Class methods for S3fsCurl
|
||||||
|
@ -1174,6 +1175,23 @@ bool S3fsCurl::SetProxyUserPwd(const char* file)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool S3fsCurl::SetIPResolveType(const char* value)
|
||||||
|
{
|
||||||
|
if(!value){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(0 == strcasecmp(value, "ipv4")){
|
||||||
|
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_V4;
|
||||||
|
}else if(0 == strcasecmp(value, "ipv6")){
|
||||||
|
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_V6;
|
||||||
|
}else if(0 == strcasecmp(value, "whatever")){ // = default type
|
||||||
|
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_WHATEVER;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// cppcheck-suppress unmatchedSuppression
|
// cppcheck-suppress unmatchedSuppression
|
||||||
// cppcheck-suppress constParameter
|
// cppcheck-suppress constParameter
|
||||||
// cppcheck-suppress constParameterCallback
|
// cppcheck-suppress constParameterCallback
|
||||||
|
@ -1949,7 +1967,11 @@ bool S3fsCurl::ResetHandle(AutoLock::Type locktype)
|
||||||
if(CURLE_OK != curl_easy_setopt(hCurl, S3FS_CURLOPT_KEEP_SENDING_ON_ERROR, 1) && !run_once){
|
if(CURLE_OK != curl_easy_setopt(hCurl, S3FS_CURLOPT_KEEP_SENDING_ON_ERROR, 1) && !run_once){
|
||||||
S3FS_PRN_WARN("The S3FS_CURLOPT_KEEP_SENDING_ON_ERROR option could not be set. For maximize performance you need to enable this option and you should use libcurl 7.51.0 or later.");
|
S3FS_PRN_WARN("The S3FS_CURLOPT_KEEP_SENDING_ON_ERROR option could not be set. For maximize performance you need to enable this option and you should use libcurl 7.51.0 or later.");
|
||||||
}
|
}
|
||||||
|
if(CURL_IPRESOLVE_WHATEVER != S3fsCurl::ipresolve_type){ // CURL_IPRESOLVE_WHATEVER is default, so not need to set.
|
||||||
|
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_IPRESOLVE, S3fsCurl::ipresolve_type)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(type != REQTYPE::IAMCRED && type != REQTYPE::IAMROLE){
|
if(type != REQTYPE::IAMCRED && type != REQTYPE::IAMROLE){
|
||||||
// REQTYPE::IAMCRED and REQTYPE::IAMROLE are always HTTP
|
// REQTYPE::IAMCRED and REQTYPE::IAMROLE are always HTTP
|
||||||
if(0 == S3fsCurl::ssl_verify_hostname){
|
if(0 == S3fsCurl::ssl_verify_hostname){
|
||||||
|
|
|
@ -156,6 +156,7 @@ class S3fsCurl
|
||||||
static std::string proxy_url;
|
static std::string proxy_url;
|
||||||
static bool proxy_http;
|
static bool proxy_http;
|
||||||
static std::string proxy_userpwd; // load from file(<username>:<passphrase>)
|
static std::string proxy_userpwd; // load from file(<username>:<passphrase>)
|
||||||
|
static long ipresolve_type; // this value is a libcurl symbol.
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
CURL* hCurl;
|
CURL* hCurl;
|
||||||
|
@ -340,6 +341,7 @@ class S3fsCurl
|
||||||
static bool IsRequesterPays() { return S3fsCurl::requester_pays; }
|
static bool IsRequesterPays() { return S3fsCurl::requester_pays; }
|
||||||
static bool SetProxy(const char* url);
|
static bool SetProxy(const char* url);
|
||||||
static bool SetProxyUserPwd(const char* userpwd);
|
static bool SetProxyUserPwd(const char* userpwd);
|
||||||
|
static bool SetIPResolveType(const char* value);
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
||||||
|
|
|
@ -5434,6 +5434,14 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if(is_prefix(arg, "ipresolve=")){
|
||||||
|
const char* pipresolve = &arg[strlen("ipresolve=")];
|
||||||
|
if(!S3fsCurl::SetIPResolveType(pipresolve)){
|
||||||
|
S3FS_PRN_EXIT("failed to ip resolve option value(%s).", pipresolve);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// log file option
|
// log file option
|
||||||
//
|
//
|
||||||
|
|
|
@ -527,6 +527,14 @@ static constexpr char help_string[] =
|
||||||
" Separate the username and passphrase with a ':' character and\n"
|
" Separate the username and passphrase with a ':' character and\n"
|
||||||
" specify each as a URL-encoded string.\n"
|
" specify each as a URL-encoded string.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" ipresolve (default=\"whatever\")\n"
|
||||||
|
" Select what type of IP addresses to use when establishing a\n"
|
||||||
|
" connection.\n"
|
||||||
|
" Default('whatever') can use addresses of all IP versions(IPv4 and\n"
|
||||||
|
" IPv6) that your system allows. If you specify 'IPv4', only IPv4\n"
|
||||||
|
" addresses are used. And when 'IPv6'is specified, only IPv6 addresses\n"
|
||||||
|
" will be used.\n"
|
||||||
|
"\n"
|
||||||
" logfile - specify the log output file.\n"
|
" logfile - specify the log output file.\n"
|
||||||
" s3fs outputs the log file to syslog. Alternatively, if s3fs is\n"
|
" s3fs outputs the log file to syslog. Alternatively, if s3fs is\n"
|
||||||
" started with the \"-f\" option specified, the log will be output\n"
|
" started with the \"-f\" option specified, the log will be output\n"
|
||||||
|
|
Loading…
Reference in New Issue