0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 16:34:13 +01:00

ircd::net: Add interface to get cipher list from acceptor w/ console cmd.

This commit is contained in:
Jason Volk 2019-03-13 17:32:39 -07:00
parent 8daddfb84a
commit 213c46d9f8
3 changed files with 44 additions and 0 deletions

View file

@ -20,6 +20,8 @@ namespace ircd::net
std::ostream &operator<<(std::ostream &s, const acceptor &);
extern conf::item<bool> listen;
std::string cipher_list(const acceptor &);
}
struct ircd::net::listener

View file

@ -945,6 +945,13 @@ ircd::net::listen
// listener
//
std::string
ircd::net::cipher_list(const acceptor &a)
{
auto &ssl(const_cast<acceptor &>(a).ssl);
return openssl::cipher_list(*ssl.native_handle());
}
std::ostream &
ircd::net::operator<<(std::ostream &s, const listener &a)
{

View file

@ -4430,6 +4430,41 @@ console_cmd__net__listen__list(opt &out, const string_view &line)
return true;
}
bool
console_cmd__net__listen__ciphers(opt &out, const string_view &line)
{
const params param{line, " ",
{
"name",
}};
const auto &name
{
param["name"]
};
using list = std::list<net::listener>;
static mods::import<list> listeners
{
"s_listen", "listeners"
};
const list &l(listeners);
for(const auto &listener : l)
{
if(name && listener.name() != name)
continue;
out << listener.name() << ": " << std::endl
<< cipher_list(listener)
<< std::endl
<< std::endl;
}
return true;
}
bool
console_cmd__net__listen(opt &out, const string_view &line)
{