mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
code for disabling default hidden service
This commit is contained in:
parent
91becb93c9
commit
1f02498fc0
5 changed files with 15 additions and 28 deletions
|
@ -227,6 +227,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||
endif()
|
||||
|
||||
set(LIB_PLATFORM_SRC
|
||||
# string stuff
|
||||
llarp/str.cpp
|
||||
# for outpug
|
||||
llarp/logger.cpp
|
||||
# needed for threading
|
||||
|
|
|
@ -165,8 +165,9 @@ extern "C"
|
|||
#endif
|
||||
f << "ifname=lokitun0" << std::endl;
|
||||
f << "ifaddr=10.200.0.1/16" << std::endl;
|
||||
f << "enabled=true" << std::endl;
|
||||
f << std::endl << std::endl;
|
||||
|
||||
|
||||
f << "# dns provider configuration section" << std::endl;
|
||||
f << "[dns]" << std::endl;
|
||||
f << "# opennic us resolver" << std::endl;
|
||||
|
|
|
@ -861,7 +861,8 @@ llarp_router::InitOutboundLink()
|
|||
bool
|
||||
llarp_router::CreateDefaultHiddenService()
|
||||
{
|
||||
return hiddenServiceContext.AddDefaultEndpoint(defaultIfAddr, defaultIfName);
|
||||
return disableDefaultEndpoint
|
||||
|| hiddenServiceContext.AddDefaultEndpoint(defaultIfAddr, defaultIfName);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1073,6 +1074,10 @@ namespace llarp
|
|||
{
|
||||
self->defaultIfAddr = val;
|
||||
}
|
||||
if(StrEq(key, "enabled"))
|
||||
{
|
||||
self->disableDefaultEndpoint = IsFalseValue(val);
|
||||
}
|
||||
}
|
||||
else if(StrEq(section, "services"))
|
||||
{
|
||||
|
|
|
@ -93,13 +93,13 @@ struct llarp_router
|
|||
|
||||
llarp::service::Context hiddenServiceContext;
|
||||
|
||||
std::string defaultIfAddr = "10.200.0.1/24";
|
||||
std::string defaultIfName = "lokitun0";
|
||||
std::string defaultIfAddr = "10.200.0.1/24";
|
||||
std::string defaultIfName = "lokitun0";
|
||||
bool disableDefaultEndpoint = false;
|
||||
|
||||
bool
|
||||
CreateDefaultHiddenService();
|
||||
|
||||
|
||||
|
||||
std::unique_ptr< llarp::ILinkLayer > outboundLink;
|
||||
std::vector< std::unique_ptr< llarp::ILinkLayer > > inboundLinks;
|
||||
|
||||
|
|
|
@ -1,22 +1 @@
|
|||
#ifndef LIBLLARP_STR_HPP
|
||||
#define LIBLLARP_STR_HPP
|
||||
#include <cstring>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
static bool
|
||||
StrEq(const char *s1, const char *s2)
|
||||
{
|
||||
size_t sz1 = strlen(s1);
|
||||
size_t sz2 = strlen(s2);
|
||||
if(sz1 == sz2)
|
||||
{
|
||||
return strncmp(s1, s2, sz1) == 0;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
||||
#include <llarp/str.hpp>
|
||||
|
|
Loading…
Reference in a new issue