2019-01-11 01:19:36 +00:00
|
|
|
#ifndef LLARP_CONFIG_HPP
|
|
|
|
#define LLARP_CONFIG_HPP
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2019-02-11 23:40:36 +00:00
|
|
|
#include <functional>
|
2019-02-12 00:33:19 +00:00
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2017-11-28 14:05:31 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
struct Config
|
|
|
|
{
|
2019-02-12 00:33:19 +00:00
|
|
|
using section_t = std::vector< std::pair< std::string, std::string > >;
|
2017-11-28 14:05:31 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
section_t router;
|
|
|
|
section_t network;
|
|
|
|
section_t netdb;
|
2018-07-26 10:53:27 +00:00
|
|
|
section_t dns;
|
2018-05-22 15:54:19 +00:00
|
|
|
section_t iwp_links;
|
|
|
|
section_t connect;
|
2018-07-09 17:32:11 +00:00
|
|
|
section_t services;
|
2018-08-09 13:55:51 +00:00
|
|
|
section_t system;
|
2019-04-07 17:55:14 +00:00
|
|
|
section_t metrics;
|
2018-10-09 12:06:30 +00:00
|
|
|
section_t api;
|
2018-11-21 17:46:33 +00:00
|
|
|
section_t lokid;
|
2018-11-28 14:58:38 +00:00
|
|
|
section_t bootstrap;
|
2017-11-28 14:05:31 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
bool
|
|
|
|
Load(const char *fname);
|
2019-02-11 14:43:48 +00:00
|
|
|
|
|
|
|
using Visitor = std::function< void(const char *section, const char *key,
|
|
|
|
const char *val) >;
|
|
|
|
|
|
|
|
void
|
|
|
|
visit(const Visitor &visitor);
|
2018-05-22 15:54:19 +00:00
|
|
|
};
|
2018-07-09 17:32:11 +00:00
|
|
|
|
2018-02-01 13:21:00 +00:00
|
|
|
} // namespace llarp
|
2017-11-28 14:05:31 +00:00
|
|
|
|
2018-10-01 09:57:57 +00:00
|
|
|
void
|
|
|
|
llarp_generic_ensure_config(std::ofstream &f, std::string basepath);
|
|
|
|
|
|
|
|
void
|
2018-10-02 23:11:44 +00:00
|
|
|
llarp_ensure_router_config(std::ofstream &f, std::string basepath);
|
2018-10-01 09:57:57 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
llarp_ensure_client_config(std::ofstream &f, std::string basepath);
|
2018-10-01 09:56:14 +00:00
|
|
|
|
2017-11-28 14:05:31 +00:00
|
|
|
#endif
|