mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-10-22 17:15:18 -04:00
Make getNetworkInterfaces() and getBestPublicIp() available via tools.h
Remove HTTP URL helper line - should be done in kiwix-serve Add getters at server level - getAddress and getPort
This commit is contained in:
1 parent
4b563e567e
commit
9554ab5db0
9 files changed
+145
-194
No files matched your search
@@ -48,6 +48,7 @@ extern "C" {
|
||||
#include "tools/regexTools.h"
|
||||
#include "tools/stringTools.h"
|
||||
#include "tools/archiveTools.h"
|
||||
#include "tools/networkTools.h"
|
||||
#include "library.h"
|
||||
#include "name_mapper.h"
|
||||
#include "entry.h"
|
||||
@@ -159,8 +160,9 @@ bool InternalServer::start() {
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_port = htons(m_port);
|
||||
if (m_addr.empty()) {
|
||||
if (0 != INADDR_ANY)
|
||||
if (0 != INADDR_ANY) {
|
||||
sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
}
|
||||
m_addr = kiwix::getBestPublicIp();
|
||||
} else {
|
||||
if (inet_pton(AF_INET, m_addr.c_str(), &(sockAddr.sin_addr.s_addr)) == 0) {
|
||||
@@ -168,11 +170,6 @@ bool InternalServer::start() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string url = "http://" + m_addr + ":" + std::to_string(m_port) + "/";
|
||||
std::cout << "The Kiwix server is running and can be accessed in the local network at : "
|
||||
<< url << std::endl;
|
||||
|
||||
mp_daemon = MHD_start_daemon(flags,
|
||||
m_port,
|
||||
NULL,
|
||||
|
||||
Reference in new issue
Block a user