nghttpx: Deprecate --backend-ipv4 and --backend-ipv6 in favor of --backend-address-family
This commit is contained in:
parent
8449958425
commit
72877379ec
|
@ -123,6 +123,7 @@ OPTIONS = [
|
||||||
"tls-ticket-key-memcached-cert-file",
|
"tls-ticket-key-memcached-cert-file",
|
||||||
"tls-ticket-key-memcached-private-key-file",
|
"tls-ticket-key-memcached-private-key-file",
|
||||||
"tls-ticket-key-memcached-address-family",
|
"tls-ticket-key-memcached-address-family",
|
||||||
|
"backend-address-family"
|
||||||
]
|
]
|
||||||
|
|
||||||
LOGVARS = [
|
LOGVARS = [
|
||||||
|
|
29
src/shrpx.cc
29
src/shrpx.cc
|
@ -1166,6 +1166,7 @@ void fill_default_config() {
|
||||||
downstreamconf.connections_per_host = 8;
|
downstreamconf.connections_per_host = 8;
|
||||||
downstreamconf.request_buffer_size = 16_k;
|
downstreamconf.request_buffer_size = 16_k;
|
||||||
downstreamconf.response_buffer_size = 128_k;
|
downstreamconf.response_buffer_size = 128_k;
|
||||||
|
downstreamconf.family = AF_UNSPEC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1270,10 +1271,12 @@ Connections:
|
||||||
--backlog=<N>
|
--backlog=<N>
|
||||||
Set listen backlog size.
|
Set listen backlog size.
|
||||||
Default: )" << get_config()->conn.listener.backlog << R"(
|
Default: )" << get_config()->conn.listener.backlog << R"(
|
||||||
--backend-ipv4
|
--backend-address-family=(auto|IPv4|IPv6)
|
||||||
Resolve backend hostname to IPv4 address only.
|
Specify address family of backend connections. If
|
||||||
--backend-ipv6
|
"auto" is given, both IPv4 and IPv6 are considered. If
|
||||||
Resolve backend hostname to IPv6 address only.
|
"IPv4" is given, only IPv4 address is considered. If
|
||||||
|
"IPv6" is given, only IPv6 address is considered.
|
||||||
|
Default: auto
|
||||||
--backend-http-proxy-uri=<URI>
|
--backend-http-proxy-uri=<URI>
|
||||||
Specify proxy URI in the form
|
Specify proxy URI in the form
|
||||||
http://[<USER>:<PASS>@]<PROXY>:<PORT>. If a proxy
|
http://[<USER>:<PASS>@]<PROXY>:<PORT>. If a proxy
|
||||||
|
@ -2055,12 +2058,6 @@ void process_options(
|
||||||
listenerconf.addrs.push_back(std::move(addr));
|
listenerconf.addrs.push_back(std::move(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downstreamconf.ipv4 && downstreamconf.ipv6) {
|
|
||||||
LOG(FATAL) << "--backend-ipv4 and --backend-ipv6 cannot be used at the "
|
|
||||||
<< "same time.";
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (upstreamconf.worker_connections == 0) {
|
if (upstreamconf.worker_connections == 0) {
|
||||||
upstreamconf.worker_connections = std::numeric_limits<size_t>::max();
|
upstreamconf.worker_connections = std::numeric_limits<size_t>::max();
|
||||||
}
|
}
|
||||||
|
@ -2195,11 +2192,8 @@ void process_options(
|
||||||
addr.hostport =
|
addr.hostport =
|
||||||
ImmutableString(util::make_hostport(addr.host.c_str(), addr.port));
|
ImmutableString(util::make_hostport(addr.host.c_str(), addr.port));
|
||||||
|
|
||||||
if (resolve_hostname(
|
if (resolve_hostname(&addr.addr, addr.host.c_str(), addr.port,
|
||||||
&addr.addr, addr.host.c_str(), addr.port,
|
downstreamconf.family) == -1) {
|
||||||
downstreamconf.ipv4
|
|
||||||
? AF_INET
|
|
||||||
: (downstreamconf.ipv6 ? AF_INET6 : AF_UNSPEC)) == -1) {
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2453,6 +2447,7 @@ int main(int argc, char **argv) {
|
||||||
&flag, 114},
|
&flag, 114},
|
||||||
{SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY,
|
{SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY,
|
||||||
required_argument, &flag, 115},
|
required_argument, &flag, 115},
|
||||||
|
{SHRPX_OPT_BACKEND_ADDRESS_FAMILY, required_argument, &flag, 116},
|
||||||
{nullptr, 0, nullptr, 0}};
|
{nullptr, 0, nullptr, 0}};
|
||||||
|
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
@ -2949,6 +2944,10 @@ int main(int argc, char **argv) {
|
||||||
cmdcfgs.emplace_back(
|
cmdcfgs.emplace_back(
|
||||||
SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY, optarg);
|
SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY, optarg);
|
||||||
break;
|
break;
|
||||||
|
case 116:
|
||||||
|
// --backend-address-family
|
||||||
|
cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_ADDRESS_FAMILY, optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -693,6 +693,7 @@ enum {
|
||||||
SHRPX_OPTID_ADD_X_FORWARDED_FOR,
|
SHRPX_OPTID_ADD_X_FORWARDED_FOR,
|
||||||
SHRPX_OPTID_ALTSVC,
|
SHRPX_OPTID_ALTSVC,
|
||||||
SHRPX_OPTID_BACKEND,
|
SHRPX_OPTID_BACKEND,
|
||||||
|
SHRPX_OPTID_BACKEND_ADDRESS_FAMILY,
|
||||||
SHRPX_OPTID_BACKEND_HTTP_PROXY_URI,
|
SHRPX_OPTID_BACKEND_HTTP_PROXY_URI,
|
||||||
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND,
|
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND,
|
||||||
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST,
|
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST,
|
||||||
|
@ -1232,6 +1233,11 @@ int option_lookup_token(const char *name, size_t namelen) {
|
||||||
return SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT;
|
return SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'y':
|
||||||
|
if (util::strieq_l("backend-address-famil", name, 21)) {
|
||||||
|
return SHRPX_OPTID_BACKEND_ADDRESS_FAMILY;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
|
@ -1854,11 +1860,17 @@ int parse_config(const char *opt, const char *optarg,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case SHRPX_OPTID_BACKEND_IPV4:
|
case SHRPX_OPTID_BACKEND_IPV4:
|
||||||
mod_config()->conn.downstream.ipv4 = util::strieq(optarg, "yes");
|
LOG(WARN) << opt
|
||||||
|
<< ": deprecated. Use backend-address-family=IPv4 instead.";
|
||||||
|
|
||||||
|
mod_config()->conn.downstream.family = AF_INET;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case SHRPX_OPTID_BACKEND_IPV6:
|
case SHRPX_OPTID_BACKEND_IPV6:
|
||||||
mod_config()->conn.downstream.ipv6 = util::strieq(optarg, "yes");
|
LOG(WARN) << opt
|
||||||
|
<< ": deprecated. Use backend-address-family=IPv6 instead.";
|
||||||
|
|
||||||
|
mod_config()->conn.downstream.family = AF_INET6;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case SHRPX_OPTID_BACKEND_HTTP_PROXY_URI: {
|
case SHRPX_OPTID_BACKEND_HTTP_PROXY_URI: {
|
||||||
|
@ -2348,6 +2360,9 @@ int parse_config(const char *opt, const char *optarg,
|
||||||
case SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY:
|
case SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY:
|
||||||
return parse_address_family(
|
return parse_address_family(
|
||||||
&mod_config()->tls.session_cache.memcached.family, opt, optarg);
|
&mod_config()->tls.session_cache.memcached.family, opt, optarg);
|
||||||
|
case SHRPX_OPTID_BACKEND_ADDRESS_FAMILY:
|
||||||
|
return parse_address_family(&mod_config()->conn.downstream.family, opt,
|
||||||
|
optarg);
|
||||||
case SHRPX_OPTID_CONF:
|
case SHRPX_OPTID_CONF:
|
||||||
LOG(WARN) << "conf: ignored";
|
LOG(WARN) << "conf: ignored";
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,7 @@ constexpr char SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE[] =
|
||||||
"tls-ticket-key-memcached-private-key-file";
|
"tls-ticket-key-memcached-private-key-file";
|
||||||
constexpr char SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY[] =
|
constexpr char SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY[] =
|
||||||
"tls-ticket-key-memcached-address-family";
|
"tls-ticket-key-memcached-address-family";
|
||||||
|
constexpr char SHRPX_OPT_BACKEND_ADDRESS_FAMILY[] = "backend-address-family";
|
||||||
|
|
||||||
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
|
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
|
||||||
|
|
||||||
|
@ -567,13 +568,12 @@ struct ConnectionConfig {
|
||||||
size_t response_buffer_size;
|
size_t response_buffer_size;
|
||||||
// downstream protocol; this will be determined by given options.
|
// downstream protocol; this will be determined by given options.
|
||||||
shrpx_proto proto;
|
shrpx_proto proto;
|
||||||
|
// Address family of backend connection. One of either AF_INET,
|
||||||
|
// AF_INET6 or AF_UNSPEC. This is ignored if backend connection
|
||||||
|
// is made via Unix domain socket.
|
||||||
|
int family;
|
||||||
bool no_tls;
|
bool no_tls;
|
||||||
bool http1_tls;
|
bool http1_tls;
|
||||||
// true if IPv4 only; ipv4 and ipv6 are mutually exclusive; and
|
|
||||||
// (ipv4 && ipv6) must be false.
|
|
||||||
bool ipv4;
|
|
||||||
// true if IPv6 only
|
|
||||||
bool ipv6;
|
|
||||||
} downstream;
|
} downstream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue