Verified Commit 0c0c4bcf authored by Pavel Doležal's avatar Pavel Doležal
Browse files

Config: Add items for ASN and Country Maxmind databases

parent b78c4dad
......@@ -133,6 +133,16 @@ default:
# Valid values are 'all', 'invalid', 'disabled'.
pcap-export: 'disabled'
# Path to Maxmind Country database. If this option is set to a valid database file, the 'country'
# field in exported Parquets or 'country-code' implementation field in exported C-DNS will be
# filled with ISO 3166-1 country code based on client's IP address.
country-maxmind-db: ''
# Path to Maxmind ASN database. If this iption is set to a valid database file, the 'asn'
# implementation field in exported Parquets or C-DNS will be filled with Autonomous System
# Number (ASN) based on client's IP address.
asn-maxmind-db: ''
# [SECTION] Configuration of client IP anonymization in exported data (Parquet or C-DNS).
# The optional PCAP export does NOT get anonymized!!!
ip-anonymization:
......
......@@ -59,6 +59,8 @@ namespace DDP {
file_rot_size(0),
file_compression(true),
pcap_export(PcapExportCfg::DISABLED),
country_db(),
asn_db(),
export_format(ExportFormat::PARQUET),
parquet_records(5000000),
cdns_fields(0xFFFFFF),
......@@ -97,6 +99,8 @@ namespace DDP {
ConfigItem<uint64_t> file_rot_size; //!< Exported file size limit in MB
ConfigItem<bool> file_compression; //!< Enable GZIP compression for exported files
ConfigItem<PcapExportCfg> pcap_export; //!< Define what will be in exported PCAPs
ConfigItem<std::string> country_db; //!< Path to Maxmind Country database
ConfigItem<std::string> asn_db; //!< Path to Maxmind ASN database
ConfigItem<ExportFormat> export_format; //!< Specify export format
ConfigItem<uint64_t> parquet_records; //!< Number of records in parquet file
......
......@@ -164,6 +164,12 @@ void DDP::ConfigFile::load_instance(Config& cfg, YAML::Node node)
if (node["export"]["pcap-export"] && node["export"]["pcap-export"].IsScalar())
cfg.pcap_export.add_value(node["export"]["pcap-export"].as<std::string>());
if (node["export"]["country-maxmind-db"] && node["export"]["country-maxmind-db"].IsScalar())
cfg.country_db.add_value(node["export"]["country-maxmind-db"].as<std::string>());
if (node["export"]["asn-maxmind-db"] && node["export"]["asn-maxmind-db"].IsScalar())
cfg.asn_db.add_value(node["export"]["asn-maxmind-db"].as<std::string>());
if (node["ip-anonymization"]["anonymize-ip"] && node["ip-anonymization"]["anonymize-ip"].IsScalar())
cfg.anonymize_ip.add_value(node["ip-anonymization"]["anonymize-ip"].as<bool>());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment