more defaults

This commit is contained in:
Jeff Becker 2018-08-09 09:55:51 -04:00
parent 32d82b5ba5
commit 6bae623481
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
4 changed files with 54 additions and 5 deletions

View File

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

30
include/llarp/defaults.h Normal file
View File

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

View File

@ -1,6 +1,6 @@
#include "config.hpp"
#include <llarp/config.h>
#include <llarp/dns.h>
#include <llarp/defaults.h>
#include <llarp/net.hpp>
#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;

View File

@ -18,6 +18,7 @@ namespace llarp
section_t iwp_links;
section_t connect;
section_t services;
section_t system;
bool
Load(const char *fname);