mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
proxy server: allow to configure address to bind
This commit is contained in:
1 parent
48e718ffd8
commit
577f2a0645
4 files changed
+11
No files matched your search
@@ -63,6 +63,7 @@ using RestRouter = restinio::router::express_router_t<>;
|
||||
using RequestStatus = restinio::request_handling_status_t;
|
||||
|
||||
struct ProxyServerConfig {
|
||||
std::string address {};
|
||||
in_port_t port {8000};
|
||||
std::string pushServer {};
|
||||
std::string persistStatePath {};
|
||||
|
||||
@@ -265,6 +265,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
|
||||
// build http server
|
||||
auto settings = restinio::run_on_this_thread_settings_t<RestRouterTraitsTls>();
|
||||
addServerSettings(settings);
|
||||
if (not config.address.empty())
|
||||
settings.address(config.address);
|
||||
settings.port(config.port);
|
||||
settings.tls_context(std::move(tls_context));
|
||||
httpsServer_ = std::make_unique<restinio::http_server_t<RestRouterTraitsTls>>(
|
||||
@@ -282,6 +284,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
|
||||
else {
|
||||
auto settings = restinio::run_on_this_thread_settings_t<RestRouterTraits>();
|
||||
addServerSettings(settings);
|
||||
if (not config.address.empty())
|
||||
settings.address(config.address);
|
||||
settings.port(config.port);
|
||||
httpServer_ = std::make_unique<restinio::http_server_t<RestRouterTraits>>(
|
||||
ioContext_,
|
||||
|
||||
@@ -551,6 +551,7 @@ main(int argc, char **argv)
|
||||
ProxyServerConfig serverConfig;
|
||||
serverConfig.pushServer = params.pushserver;
|
||||
serverConfig.bundleId = params.bundle_id;
|
||||
serverConfig.address = params.proxy_address;
|
||||
if (params.proxyserverssl and params.proxy_id.first and params.proxy_id.second){
|
||||
serverConfig.identity = params.proxy_id;
|
||||
serverConfig.port = params.proxyserverssl;
|
||||
|
||||
@@ -131,6 +131,7 @@ struct dht_params {
|
||||
in_port_t proxyserver {0};
|
||||
in_port_t proxyserverssl {0};
|
||||
std::string proxyclient {};
|
||||
std::string proxy_address {};
|
||||
std::string pushserver {};
|
||||
std::string devicekey {};
|
||||
std::string bundle_id {};
|
||||
@@ -224,6 +225,7 @@ static const constexpr struct option long_options[] = {
|
||||
{"syslog", no_argument , nullptr, 'L'},
|
||||
{"proxyserver", required_argument, nullptr, 'S'},
|
||||
{"proxyserverssl", required_argument, nullptr, 'e'},
|
||||
{"proxy-addr", required_argument, nullptr, 'a'},
|
||||
{"proxy-certificate", required_argument, nullptr, 'w'},
|
||||
{"proxy-privkey", required_argument, nullptr, 'K'},
|
||||
{"proxy-privkey-password", required_argument, nullptr, 'M'},
|
||||
@@ -270,6 +272,9 @@ parseArgs(int argc, char **argv) {
|
||||
case 'D':
|
||||
params.peer_discovery = true;
|
||||
break;
|
||||
case 'a':
|
||||
params.proxy_address = optarg;
|
||||
break;
|
||||
case 'y':
|
||||
params.pushserver = optarg;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user