diff --git a/CMakeLists.txt b/CMakeLists.txt index 76f1c8024..bd554924b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ else() message(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or C++17 support. Please use a different C++ compiler.") endif() +if(DEBIAN) + add_definitions(-DDEBIAN) +endif() + if(ANDROID) set(THREAD_LIB "-pthread") # finally removed pthread dependency for MSC++ diff --git a/include/llarp/defaults.h b/include/llarp/defaults.h new file mode 100644 index 000000000..a34f01896 --- /dev/null +++ b/include/llarp/defaults.h @@ -0,0 +1,30 @@ +#ifndef LLARP_DEFAULTS_H +#define LLARP_DEFAULTS_H + +#ifndef DEFAULT_RESOLVER_US +#define DEFAULT_RESOLVER_US "128.52.130.209" +#endif +#ifndef DEFAULT_RESOLVER_EU +#define DEFAULT_RESOLVER_EU "85.208.208.141" +#endif +#ifndef DEFAULT_RESOLVER_AU +#define DEFAULT_RESOLVER_AU "103.236.162.119" +#endif + +#ifdef DEBIAN +#ifndef DEFAULT_LOKINET_USER +#define DEFAULT_LOKINET_USER "debian-lokinet" +#endif +#ifndef DEFAULT_LOKINET_GROUP +#define DEFAULT_LOKINET_GROUP "debian-lokinet" +#endif +#else +#ifndef DEFAULT_LOKINET_USER +#define DEFAULT_LOKINET_USER "lokinet" +#endif +#ifndef DEFAULT_LOKINET_GROUP +#define DEFAULT_LOKINET_GROUP "lokinet" +#endif +#endif + +#endif \ No newline at end of file diff --git a/llarp/config.cpp b/llarp/config.cpp index 66de363e0..899f248c0 100644 --- a/llarp/config.cpp +++ b/llarp/config.cpp @@ -1,6 +1,6 @@ #include "config.hpp" #include -#include +#include #include #include "fs.hpp" #include "ini.hpp" @@ -35,6 +35,7 @@ namespace llarp iwp_links = find_section(top, "bind", section_t{}); services = find_section(top, "services", section_t{}); dns = find_section(top, "dns", section_t{}); + system = find_section(top, "system", section_t{}); return true; } return false; @@ -47,7 +48,7 @@ extern "C" void llarp_new_config(struct llarp_config **conf) { - llarp_config *c = new llarp_config; + llarp_config *c = new llarp_config(); *conf = c; } @@ -73,9 +74,10 @@ extern "C" { iter->conf = conf; std::map< std::string, llarp::Config::section_t & > sections = { - {"network", conf->impl.network}, {"connect", conf->impl.connect}, - {"bind", conf->impl.iwp_links}, {"netdb", conf->impl.netdb}, - {"dns", conf->impl.dns}, {"services", conf->impl.services}}; + {"network", conf->impl.network}, {"connect", conf->impl.connect}, + {"system", conf->impl.system}, {"bind", conf->impl.iwp_links}, + {"netdb", conf->impl.netdb}, {"dns", conf->impl.dns}, + {"services", conf->impl.services}}; for(const auto item : conf->impl.router) iter->visit(iter, "router", item.first.c_str(), item.second.c_str()); @@ -108,6 +110,18 @@ extern "C" << std::endl; f << "# change these values as desired" << std::endl; f << std::endl; + + f << "# system settings for priviledges and such" << std::endl; + f << "[system]" << std::endl; +#ifdef _WIN32 + f << "# "; +#endif + f << "user=" << DEFAULT_LOKINET_USER << std::endl; +#ifdef _WIN32 + f << "# "; +#endif + f << "group=" << DEFAULT_LOKINET_GROUP << std::endl; + f << "# configuration for lokinet network interface" << std::endl; f << "[network]" << std::endl; f << "# interface name" << std::endl; diff --git a/llarp/config.hpp b/llarp/config.hpp index f9ea2c102..a24e5cf97 100644 --- a/llarp/config.hpp +++ b/llarp/config.hpp @@ -18,6 +18,7 @@ namespace llarp section_t iwp_links; section_t connect; section_t services; + section_t system; bool Load(const char *fname);