mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-08 14:46:10 -04:00
kiwix-serve displays both protocol attached ips
This commit is contained in:
parent
c6b72e9362
commit
b1dd681c59
@ -324,17 +324,17 @@ int main(int argc, char** argv)
|
|||||||
auto libraryFileTimestamp = newestFileTimestamp(libraryPaths);
|
auto libraryFileTimestamp = newestFileTimestamp(libraryPaths);
|
||||||
auto curLibraryFileTimestamp = libraryFileTimestamp;
|
auto curLibraryFileTimestamp = libraryFileTimestamp;
|
||||||
|
|
||||||
/* Infer ipMode from address */
|
kiwix::IpMode ipMode = kiwix::IpMode::AUTO;
|
||||||
kiwix::IpMode ipMode = kiwix::IpMode::ipv4;
|
|
||||||
|
|
||||||
if (address == "all"){
|
if (address == "all"){
|
||||||
address = "";
|
address = "";
|
||||||
ipMode = kiwix::IpMode::all;
|
ipMode = kiwix::IpMode::ALL;
|
||||||
} else if (address == "ipv4"){
|
} else if (address == "ipv4"){
|
||||||
address = "";
|
address = "";
|
||||||
|
ipMode = kiwix::IpMode::IPV4;
|
||||||
} else if (address == "ipv6"){
|
} else if (address == "ipv6"){
|
||||||
address = "";
|
address = "";
|
||||||
ipMode = kiwix::IpMode::ipv6;
|
ipMode = kiwix::IpMode::IPV6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -384,12 +384,12 @@ int main(int argc, char** argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string host = (server.getIpMode()==kiwix::IpMode::all || server.getIpMode()==kiwix::IpMode::ipv6)
|
std::string prefix = "http://";
|
||||||
? "[" + server.getAddress() + "]" : server.getAddress();
|
kiwix::IpAddress addresses = server.getAddress();
|
||||||
|
std::string suffix = ":" + std::to_string(server.getPort()) + normalizeRootUrl(rootLocation);
|
||||||
std::string url = "http://" + host + ":" + std::to_string(server.getPort()) + normalizeRootUrl(rootLocation);
|
std::cout << "The Kiwix server is running and can be accessed in the local network at: " << std::endl;
|
||||||
std::cout << "The Kiwix server is running and can be accessed in the local network at: "
|
if(!addresses.addr.empty()) std::cout << " - " << prefix << addresses.addr << suffix << std::endl;
|
||||||
<< url << std::endl;
|
if(!addresses.addr6.empty()) std::cout << " - " << prefix << "[" << addresses.addr6 << "]" << suffix << std::endl;
|
||||||
|
|
||||||
/* Run endless (until PPID dies) */
|
/* Run endless (until PPID dies) */
|
||||||
waiting = true;
|
waiting = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user