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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
b31a29ea
Commit
b31a29ea
authored
5 years ago
by
Seva
Committed by
Adrien Béraud
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
dhtproxy: run in both http & https
parent
833bd069
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/dhtnode.cpp
+27
-3
27 additions, 3 deletions
tools/dhtnode.cpp
tools/tools_common.h
+10
-0
10 additions, 0 deletions
tools/tools_common.h
with
37 additions
and
3 deletions
tools/dhtnode.cpp
+
27
−
3
View file @
b31a29ea
...
...
@@ -40,7 +40,7 @@ void print_version() {
}
void
print_usage
()
{
std
::
cout
<<
"Usage: dhtnode [-v [-l logfile]] [-i] [-d] [-n network_id] [-p local_port] [-b bootstrap_host[:port]] [--proxyserver local_port]"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"Usage: dhtnode [-v [-l logfile]] [-i] [-d] [-n network_id] [-p local_port] [-b bootstrap_host[:port]] [--proxyserver
local_port] [--proxyserverssl
local_port]"
<<
std
::
endl
<<
std
::
endl
;
print_info
();
}
...
...
@@ -79,6 +79,7 @@ void print_help() {
<<
" pst [port] <pushServer> Start the proxy interface on port."
<<
std
::
endl
#else
<<
" pst [port] Start the proxy interface on port."
<<
std
::
endl
<<
" psx [port] Start the proxy ssl interface on port."
<<
std
::
endl
#endif // OPENDHT_PUSH_NOTIFICATIONS
<<
" psp [port] Stop the proxy interface on port."
<<
std
::
endl
;
#endif //OPENDHT_PROXY_SERVER
...
...
@@ -222,6 +223,23 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
iss
>>
idstr
>>
pushServer
;
#else
iss
>>
idstr
;
#endif // OPENDHT_PUSH_NOTIFICATIONS
try
{
unsigned
int
port
=
std
::
stoi
(
idstr
);
proxies
.
emplace
(
port
,
std
::
unique_ptr
<
DhtProxyServer
>
(
new
DhtProxyServer
(
dht
::
crypto
::
Identity
{},
node
,
port
#ifdef OPENDHT_PUSH_NOTIFICATIONS
,
pushServer
#endif
)));
}
catch
(...)
{
}
continue
;
}
else
if
(
op
==
"psx"
)
{
#ifdef OPENDHT_PUSH_NOTIFICATIONS
iss
>>
idstr
>>
pushServer
;
#else
iss
>>
idstr
;
#endif // OPENDHT_PUSH_NOTIFICATIONS
try
{
unsigned
int
port
=
std
::
stoi
(
idstr
);
...
...
@@ -557,11 +575,17 @@ main(int argc, char **argv)
#ifdef OPENDHT_PROXY_SERVER
std
::
map
<
in_port_t
,
std
::
unique_ptr
<
DhtProxyServer
>>
proxies
;
#endif
if
(
params
.
proxyserver
!=
0
)
{
if
(
params
.
proxyserver
ssl
!=
0
)
{
#ifdef OPENDHT_PROXY_SERVER
proxies
.
emplace
(
params
.
proxyserver
,
std
::
unique_ptr
<
DhtProxyServer
>
(
proxies
.
emplace
(
params
.
proxyserver
ssl
,
std
::
unique_ptr
<
DhtProxyServer
>
(
new
DhtProxyServer
(
params
.
generate_identity
?
params
.
id
:
dht
::
crypto
::
Identity
{},
node
,
params
.
proxyserverssl
,
params
.
pushserver
,
context
.
logger
)));
}
if
(
params
.
proxyserver
!=
0
)
{
proxies
.
emplace
(
params
.
proxyserver
,
std
::
unique_ptr
<
DhtProxyServer
>
(
new
DhtProxyServer
(
dht
::
crypto
::
Identity
{},
node
,
params
.
proxyserver
,
params
.
pushserver
,
context
.
logger
)));
#else
std
::
cerr
<<
"DHT proxy server requested but OpenDHT built without proxy server support."
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
tools/tools_common.h
+
10
−
0
View file @
b31a29ea
...
...
@@ -121,6 +121,7 @@ struct dht_params {
dht
::
NetId
network
{
0
};
in_port_t
port
{
0
};
in_port_t
proxyserver
{
0
};
in_port_t
proxyserverssl
{
0
};
std
::
string
proxyclient
{};
std
::
string
pushserver
{};
std
::
string
devicekey
{};
...
...
@@ -148,6 +149,7 @@ static const constexpr struct option long_options[] = {
{
"logfile"
,
required_argument
,
nullptr
,
'l'
},
{
"syslog"
,
no_argument
,
nullptr
,
'L'
},
{
"proxyserver"
,
required_argument
,
nullptr
,
'S'
},
{
"proxyserverssl"
,
required_argument
,
nullptr
,
'e'
},
{
"proxyclient"
,
required_argument
,
nullptr
,
'C'
},
{
"pushserver"
,
required_argument
,
nullptr
,
'y'
},
{
"devicekey"
,
required_argument
,
nullptr
,
'z'
},
...
...
@@ -178,6 +180,14 @@ parseArgs(int argc, char **argv) {
std
::
cout
<<
"Invalid port: "
<<
port_arg
<<
std
::
endl
;
}
break
;
case
'e'
:
{
int
port_arg
=
atoi
(
optarg
);
if
(
port_arg
>=
0
&&
port_arg
<
0x10000
)
params
.
proxyserverssl
=
port_arg
;
else
std
::
cout
<<
"Invalid port: "
<<
port_arg
<<
std
::
endl
;
}
break
;
case
'D'
:
params
.
peer_discovery
=
true
;
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