{ "getDNSCryptBindCount", true, "", "returns the number of DNSCrypt listeners" },
{ "getDOHFrontend", true, "n", "returns the DOH frontend with index n" },
{ "getDOHFrontendCount", true, "", "returns the number of DoH listeners" },
+ { "getListOfAddressesOfNetworkInterface", true, "itf", "returns the list of addresses configured on a given network interface, as strings" },
+ { "getListOfNetworkInterfaces", true, "", "returns the list of network interfaces present on the system, as strings" },
{ "getOutgoingTLSSessionCacheSize", true, "", "returns the number of TLS sessions (for outgoing connections) currently cached" },
{ "getPool", true, "name", "return the pool named `name`, or \"\" for the default pool" },
{ "getPoolServers", true, "pool", "return servers part of this pool" },
return parameters;
});
+
+ luaCtx.writeFunction("getListOfNetworkInterfaces", []() {
+ std::vector<std::pair<int, std::string>> result;
+ auto itfs = getListOfNetworkInterfaces();
+ int counter = 1;
+ for (const auto& itf : itfs) {
+ result.push_back({counter++, itf});
+ }
+ return result;
+ });
+
+ luaCtx.writeFunction("getListOfAddressesOfNetworkInterface", [](const std::string& itf) {
+ std::vector<std::pair<int, std::string>> result;
+ auto addrs = getListOfAddressesOfNetworkInterface(itf);
+ int counter = 1;
+ for (const auto& addr : addrs) {
+ result.push_back({counter++, addr.toString()});
+ }
+ return result;
+ });
}
Return the number of DOHFrontend binds.
+.. function:: getListOfAddressesOfNetworkInterface(itf)
+
+ .. versionadded:: 1.8.0
+
+ Return the list of addresses configured on a given network interface, as strings.
+ This function requires support for ``getifaddrs``, which is known to be present on FreeBSD, Linux, and OpenBSD at least.
+
+ :param str itf: The name of the network interface
+
+.. function:: getListOfNetworkInterfaces()
+
+ .. versionadded:: 1.8.0
+
+ Return the list of network interfaces configured on the system, as strings
+ This function requires support for ``getifaddrs``, which is known to be present on FreeBSD, Linux, and OpenBSD at least.
+
.. function:: getOutgoingTLSSessionCacheSize()
.. versionadded:: 1.7.0