Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
577f2a06
Commit
577f2a06
authored
2 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy server: allow to configure address to bind
parent
48e718ff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/opendht/dht_proxy_server.h
+1
-0
1 addition, 0 deletions
include/opendht/dht_proxy_server.h
src/dht_proxy_server.cpp
+4
-0
4 additions, 0 deletions
src/dht_proxy_server.cpp
tools/dhtnode.cpp
+1
-0
1 addition, 0 deletions
tools/dhtnode.cpp
tools/tools_common.h
+5
-0
5 additions, 0 deletions
tools/tools_common.h
with
11 additions
and
0 deletions
include/opendht/dht_proxy_server.h
+
1
−
0
View file @
577f2a06
...
@@ -63,6 +63,7 @@ using RestRouter = restinio::router::express_router_t<>;
...
@@ -63,6 +63,7 @@ using RestRouter = restinio::router::express_router_t<>;
using
RequestStatus
=
restinio
::
request_handling_status_t
;
using
RequestStatus
=
restinio
::
request_handling_status_t
;
struct
ProxyServerConfig
{
struct
ProxyServerConfig
{
std
::
string
address
{};
in_port_t
port
{
8000
};
in_port_t
port
{
8000
};
std
::
string
pushServer
{};
std
::
string
pushServer
{};
std
::
string
persistStatePath
{};
std
::
string
persistStatePath
{};
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_server.cpp
+
4
−
0
View file @
577f2a06
...
@@ -265,6 +265,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
...
@@ -265,6 +265,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
// build http server
// build http server
auto
settings
=
restinio
::
run_on_this_thread_settings_t
<
RestRouterTraitsTls
>
();
auto
settings
=
restinio
::
run_on_this_thread_settings_t
<
RestRouterTraitsTls
>
();
addServerSettings
(
settings
);
addServerSettings
(
settings
);
if
(
not
config
.
address
.
empty
())
settings
.
address
(
config
.
address
);
settings
.
port
(
config
.
port
);
settings
.
port
(
config
.
port
);
settings
.
tls_context
(
std
::
move
(
tls_context
));
settings
.
tls_context
(
std
::
move
(
tls_context
));
httpsServer_
=
std
::
make_unique
<
restinio
::
http_server_t
<
RestRouterTraitsTls
>>
(
httpsServer_
=
std
::
make_unique
<
restinio
::
http_server_t
<
RestRouterTraitsTls
>>
(
...
@@ -282,6 +284,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
...
@@ -282,6 +284,8 @@ DhtProxyServer::DhtProxyServer(const std::shared_ptr<DhtRunner>& dht,
else
{
else
{
auto
settings
=
restinio
::
run_on_this_thread_settings_t
<
RestRouterTraits
>
();
auto
settings
=
restinio
::
run_on_this_thread_settings_t
<
RestRouterTraits
>
();
addServerSettings
(
settings
);
addServerSettings
(
settings
);
if
(
not
config
.
address
.
empty
())
settings
.
address
(
config
.
address
);
settings
.
port
(
config
.
port
);
settings
.
port
(
config
.
port
);
httpServer_
=
std
::
make_unique
<
restinio
::
http_server_t
<
RestRouterTraits
>>
(
httpServer_
=
std
::
make_unique
<
restinio
::
http_server_t
<
RestRouterTraits
>>
(
ioContext_
,
ioContext_
,
...
...
This diff is collapsed.
Click to expand it.
tools/dhtnode.cpp
+
1
−
0
View file @
577f2a06
...
@@ -551,6 +551,7 @@ main(int argc, char **argv)
...
@@ -551,6 +551,7 @@ main(int argc, char **argv)
ProxyServerConfig
serverConfig
;
ProxyServerConfig
serverConfig
;
serverConfig
.
pushServer
=
params
.
pushserver
;
serverConfig
.
pushServer
=
params
.
pushserver
;
serverConfig
.
bundleId
=
params
.
bundle_id
;
serverConfig
.
bundleId
=
params
.
bundle_id
;
serverConfig
.
address
=
params
.
proxy_address
;
if
(
params
.
proxyserverssl
and
params
.
proxy_id
.
first
and
params
.
proxy_id
.
second
){
if
(
params
.
proxyserverssl
and
params
.
proxy_id
.
first
and
params
.
proxy_id
.
second
){
serverConfig
.
identity
=
params
.
proxy_id
;
serverConfig
.
identity
=
params
.
proxy_id
;
serverConfig
.
port
=
params
.
proxyserverssl
;
serverConfig
.
port
=
params
.
proxyserverssl
;
...
...
This diff is collapsed.
Click to expand it.
tools/tools_common.h
+
5
−
0
View file @
577f2a06
...
@@ -131,6 +131,7 @@ struct dht_params {
...
@@ -131,6 +131,7 @@ struct dht_params {
in_port_t
proxyserver
{
0
};
in_port_t
proxyserver
{
0
};
in_port_t
proxyserverssl
{
0
};
in_port_t
proxyserverssl
{
0
};
std
::
string
proxyclient
{};
std
::
string
proxyclient
{};
std
::
string
proxy_address
{};
std
::
string
pushserver
{};
std
::
string
pushserver
{};
std
::
string
devicekey
{};
std
::
string
devicekey
{};
std
::
string
bundle_id
{};
std
::
string
bundle_id
{};
...
@@ -224,6 +225,7 @@ static const constexpr struct option long_options[] = {
...
@@ -224,6 +225,7 @@ static const constexpr struct option long_options[] = {
{
"syslog"
,
no_argument
,
nullptr
,
'L'
},
{
"syslog"
,
no_argument
,
nullptr
,
'L'
},
{
"proxyserver"
,
required_argument
,
nullptr
,
'S'
},
{
"proxyserver"
,
required_argument
,
nullptr
,
'S'
},
{
"proxyserverssl"
,
required_argument
,
nullptr
,
'e'
},
{
"proxyserverssl"
,
required_argument
,
nullptr
,
'e'
},
{
"proxy-addr"
,
required_argument
,
nullptr
,
'a'
},
{
"proxy-certificate"
,
required_argument
,
nullptr
,
'w'
},
{
"proxy-certificate"
,
required_argument
,
nullptr
,
'w'
},
{
"proxy-privkey"
,
required_argument
,
nullptr
,
'K'
},
{
"proxy-privkey"
,
required_argument
,
nullptr
,
'K'
},
{
"proxy-privkey-password"
,
required_argument
,
nullptr
,
'M'
},
{
"proxy-privkey-password"
,
required_argument
,
nullptr
,
'M'
},
...
@@ -270,6 +272,9 @@ parseArgs(int argc, char **argv) {
...
@@ -270,6 +272,9 @@ parseArgs(int argc, char **argv) {
case
'D'
:
case
'D'
:
params
.
peer_discovery
=
true
;
params
.
peer_discovery
=
true
;
break
;
break
;
case
'a'
:
params
.
proxy_address
=
optarg
;
break
;
case
'y'
:
case
'y'
:
params
.
pushserver
=
optarg
;
params
.
pushserver
=
optarg
;
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment