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
38ad5b9e
Commit
38ad5b9e
authored
7 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
add --proxyserver option for dhtnode
parent
67ba435b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/dhtnode.cpp
+4
-1
4 additions, 1 deletion
tools/dhtnode.cpp
tools/tools_common.h
+10
-0
10 additions, 0 deletions
tools/tools_common.h
with
14 additions
and
1 deletion
tools/dhtnode.cpp
+
4
−
1
View file @
38ad5b9e
...
@@ -29,7 +29,7 @@ extern "C" {
...
@@ -29,7 +29,7 @@ extern "C" {
using
namespace
dht
;
using
namespace
dht
;
void
print_usage
()
{
void
print_usage
()
{
std
::
cout
<<
"Usage: dhtnode [-v [-l logfile]] [-i] [-d] [-n network_id] [-p local_port] [-b bootstrap_host[: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]
"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"dhtnode, a simple OpenDHT command line node runner."
<<
std
::
endl
;
std
::
cout
<<
"dhtnode, a simple OpenDHT command line node runner."
<<
std
::
endl
;
std
::
cout
<<
"Report bugs to: http://opendht.net"
<<
std
::
endl
;
std
::
cout
<<
"Report bugs to: http://opendht.net"
<<
std
::
endl
;
}
}
...
@@ -92,6 +92,9 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params)
...
@@ -92,6 +92,9 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params)
std
::
map
<
std
::
string
,
indexation
::
Pht
>
indexes
;
std
::
map
<
std
::
string
,
indexation
::
Pht
>
indexes
;
#if OPENDHT_PROXY_SERVER
#if OPENDHT_PROXY_SERVER
std
::
map
<
in_port_t
,
std
::
unique_ptr
<
DhtProxyServer
>>
proxies
;
std
::
map
<
in_port_t
,
std
::
unique_ptr
<
DhtProxyServer
>>
proxies
;
if
(
params
.
proxyserver
!=
0
)
{
proxies
.
emplace
(
params
.
proxyserver
,
new
DhtProxyServer
(
dht
,
params
.
proxyserver
));
}
#endif //OPENDHT_PROXY_SERVER
#endif //OPENDHT_PROXY_SERVER
while
(
true
)
while
(
true
)
...
...
This diff is collapsed.
Click to expand it.
tools/tools_common.h
+
10
−
0
View file @
38ad5b9e
...
@@ -121,6 +121,7 @@ struct dht_params {
...
@@ -121,6 +121,7 @@ struct dht_params {
bool
daemonize
{
false
};
bool
daemonize
{
false
};
bool
service
{
false
};
bool
service
{
false
};
std
::
pair
<
std
::
string
,
std
::
string
>
bootstrap
{};
std
::
pair
<
std
::
string
,
std
::
string
>
bootstrap
{};
in_port_t
proxyserver
{
0
};
};
};
static
const
constexpr
struct
option
long_options
[]
=
{
static
const
constexpr
struct
option
long_options
[]
=
{
...
@@ -134,6 +135,7 @@ static const constexpr struct option long_options[] = {
...
@@ -134,6 +135,7 @@ static const constexpr struct option long_options[] = {
{
"service"
,
no_argument
,
nullptr
,
's'
},
{
"service"
,
no_argument
,
nullptr
,
's'
},
{
"logfile"
,
required_argument
,
nullptr
,
'l'
},
{
"logfile"
,
required_argument
,
nullptr
,
'l'
},
{
"syslog"
,
no_argument
,
nullptr
,
'L'
},
{
"syslog"
,
no_argument
,
nullptr
,
'L'
},
{
"proxyserver"
,
required_argument
,
nullptr
,
'S'
},
{
nullptr
,
0
,
nullptr
,
0
}
{
nullptr
,
0
,
nullptr
,
0
}
};
};
...
@@ -151,6 +153,14 @@ parseArgs(int argc, char **argv) {
...
@@ -151,6 +153,14 @@ parseArgs(int argc, char **argv) {
std
::
cout
<<
"Invalid port: "
<<
port_arg
<<
std
::
endl
;
std
::
cout
<<
"Invalid port: "
<<
port_arg
<<
std
::
endl
;
}
}
break
;
break
;
case
'S'
:
{
int
port_arg
=
atoi
(
optarg
);
if
(
port_arg
>=
0
&&
port_arg
<
0x10000
)
params
.
proxyserver
=
port_arg
;
else
std
::
cout
<<
"Invalid port: "
<<
port_arg
<<
std
::
endl
;
}
break
;
case
'n'
:
case
'n'
:
params
.
network
=
strtoul
(
optarg
,
nullptr
,
0
);
params
.
network
=
strtoul
(
optarg
,
nullptr
,
0
);
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