From 83101679a0f813fe7d1fb4ee83c5b4cf64213380 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 3 Jun 2024 16:12:34 +0400 Subject: [PATCH] Backward compatible overload of getBestPublicIp() --- include/tools.h | 14 ++++++++++---- src/tools/networkTools.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/tools.h b/include/tools.h index 8ac60312e..a743b25f3 100644 --- a/include/tools.h +++ b/include/tools.h @@ -231,6 +231,12 @@ std::map getNetworkInterfaces(); */ std::string getBestPublicIp(bool ipv6); +/** Provides the best IPv4 adddress + * Equivalent to getBestPublicIp(false). Provided for backward compatibility + * with libkiwix v13.1.0. + */ +std::string getBestPublicIp(); + /** Converts file size to human readable format. * * This function will convert a number to its equivalent size using units. @@ -242,15 +248,15 @@ std::string beautifyFileSize(uint64_t number); /** * Load languages stored in an OPDS stream. - * + * * @param content the OPDS stream. - * @return vector containing pairs of language code and their corresponding full language name. + * @return vector containing pairs of language code and their corresponding full language name. */ FeedLanguages readLanguagesFromFeed(const std::string& content); /** * Load categories stored in an OPDS stream . - * + * * @param content the OPDS stream. * @return vector containing category strings. */ @@ -258,7 +264,7 @@ FeedCategories readCategoriesFromFeed(const std::string& content); /** * Retrieve the full language name associated with a given ISO 639-3 language code. - * + * * @param lang ISO 639-3 language code. * @return full language name. */ diff --git a/src/tools/networkTools.cpp b/src/tools/networkTools.cpp index c1b61335f..ca106d8b1 100644 --- a/src/tools/networkTools.cpp +++ b/src/tools/networkTools.cpp @@ -213,3 +213,9 @@ std::string kiwix::getBestPublicIp(bool ipv6) { } return ipv6 ? bestPublicIp.addr6 : bestPublicIp.addr; } + + +std::string kiwix::getBestPublicIp() +{ + return getBestPublicIp(false); +}