mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
modules/console: Add net__peer__version to list all gathered peer.server_name.
This commit is contained in:
parent
ef791ae46e
commit
907f2d0435
1 changed files with 33 additions and 0 deletions
|
@ -513,6 +513,7 @@ console_cmd__net(const string_view &line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool console_cmd__net__peer__version(const string_view &line);
|
||||||
static bool console_cmd__net_peer__clear(const string_view &line);
|
static bool console_cmd__net_peer__clear(const string_view &line);
|
||||||
static bool console_cmd__net_peer__default();
|
static bool console_cmd__net_peer__default();
|
||||||
|
|
||||||
|
@ -532,6 +533,9 @@ console_cmd__net_peer(const string_view &line)
|
||||||
case hash("clear"):
|
case hash("clear"):
|
||||||
return console_cmd__net_peer__clear(args);
|
return console_cmd__net_peer__clear(args);
|
||||||
|
|
||||||
|
case hash("version"):
|
||||||
|
return console_cmd__net__peer__version(args);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw bad_command{};
|
throw bad_command{};
|
||||||
}
|
}
|
||||||
|
@ -556,6 +560,35 @@ console_cmd__net_peer__clear(const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__net__peer__version(const string_view &line)
|
||||||
|
{
|
||||||
|
for(const auto &p : server::peers)
|
||||||
|
{
|
||||||
|
using std::setw;
|
||||||
|
using std::left;
|
||||||
|
using std::right;
|
||||||
|
|
||||||
|
const auto &host{p.first};
|
||||||
|
const auto &peer{*p.second};
|
||||||
|
const net::ipport &ipp{peer.remote};
|
||||||
|
|
||||||
|
out << setw(40) << right << host;
|
||||||
|
|
||||||
|
if(ipp)
|
||||||
|
out << ' ' << setw(22) << left << ipp;
|
||||||
|
else
|
||||||
|
out << ' ' << setw(22) << left << " ";
|
||||||
|
|
||||||
|
if(!empty(peer.server_name))
|
||||||
|
out << " :" << peer.server_name;
|
||||||
|
|
||||||
|
out << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__net_peer__default()
|
console_cmd__net_peer__default()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue