Ejemplo n.º 1
0
gdmaps_t* gdmaps_test_load(const char* cfg_data) {
    vscf_data_t* maps_cfg = vscf_scan_buf(strlen(cfg_data), cfg_data, "(test maps)", false);
    if(!maps_cfg)
        log_fatal("Test config load failed");
    if(!vscf_is_hash(maps_cfg))
        log_fatal("Geoip plugin config for 'maps' must be a hash");
    gdmaps_t* rv = gdmaps_new(maps_cfg);
    vscf_destroy(maps_cfg);

    gdmaps_load_databases(rv);

    return rv;
}
Ejemplo n.º 2
0
gdmaps_t* gdmaps_test_init(const char* input_cfgdir) {

    dmn_init1(false, true, true, false, "gdmaps_test");

    const vscf_data_t* cfg_root = conf_load_vscf(input_cfgdir);
    const vscf_data_t* maps_cfg = conf_get_maps(cfg_root);
    gdmaps_t* gdmaps = gdmaps_new(maps_cfg);
    vscf_destroy(cfg_root);

    gdmaps_load_databases(gdmaps);
    gdmaps_setup_watchers(gdmaps);

    return gdmaps;
}
Ejemplo n.º 3
0
gdmaps_t* gdmaps_test_init(const char* config_path) {

    dmn_init_log();

    dmn_assert(config_path);

    const vscf_data_t* cfg_root = conf_load(config_path);
    conf_options(cfg_root);
    gdnsd_set_cfdir(config_path);

    const vscf_data_t* maps_cfg = conf_get_maps(cfg_root);
    gdmaps_t* gdmaps = gdmaps_new(maps_cfg);
    vscf_destroy(cfg_root);

    gdmaps_load_geoip_databases(gdmaps);
    gdmaps_setup_geoip_watcher_paths(gdmaps);
    gdmaps_setup_geoip_watchers(gdmaps);

    return gdmaps;
}