add ipv6 support to HTTP daemon

This commit is contained in:
Aryan Arora
2024-04-20 15:28:35 +05:30
committed by Kelson
parent 618a718645
commit a6cf161341
6 changed files with 177 additions and 88 deletions

View File

@ -62,8 +62,10 @@ namespace kiwix
{ m_withTaskbar = withTaskbar; m_withLibraryButton = withLibraryButton; }
void setBlockExternalLinks(bool blockExternalLinks)
{ m_blockExternalLinks = blockExternalLinks; }
void setIPv6(bool ipv6) { m_ipv6 = ipv6; }
int getPort();
std::string getAddress();
bool isAddressIPv6();
protected:
std::shared_ptr<Library> mp_library;
@ -78,6 +80,7 @@ namespace kiwix
bool m_withTaskbar = true;
bool m_withLibraryButton = true;
bool m_blockExternalLinks = false;
bool m_ipv6 = false;
int m_ipConnectionLimit = 0;
std::unique_ptr<InternalServer> mp_server;
};

View File

@ -25,6 +25,11 @@
#include <map>
#include <cstdint>
struct ip_addr{
std::string addr;
std::string addr6;
};
namespace kiwix {
typedef std::pair<std::string, std::string> LangNameCodePair;
typedef std::vector<LangNameCodePair> FeedLanguages;
@ -215,16 +220,28 @@ bool fileReadable(const std::string& path);
*/
std::string getMimeTypeForFile(const std::string& filename);
/** Provides all available network interfaces on Windows
*
* This function provides the available IPv4 and IPv6 network interfaces
*/
std::map<std::string,ip_addr> getNetworkInterfacesWin();
/** Provides all available network interfaces on Posix
*
* This function provides the available IPv4 and IPv6 network interfaces
*/
std::map<std::string,ip_addr> getNetworkInterfacesPosix();
/** Provides all available network interfaces
*
* This function provides the available IPv4 network interfaces
* This function provides the available IPv4 and IPv6 network interfaces
*/
std::map<std::string, std::string> getNetworkInterfaces();
std::map<std::string,ip_addr> getNetworkInterfaces();
/** Provides the best IP address
* This function provides the best IP address from the list given by getNetworkInterfaces
*/
std::string getBestPublicIp();
std::string getBestPublicIp(bool ipv6);
/** Converts file size to human readable format.
*