1
1
Fork 0
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:
Jeff Becker 2018-10-03 06:59:30 -04:00
parent 91becb93c9
commit 1f02498fc0
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05
5 changed files with 15 additions and 28 deletions

View file

@ -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

View file

@ -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;

View file

@ -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"))
{

View file

@ -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;

View file

@ -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>