diff options
| author | namilsk <namilsk@namilsk.tech> | 2026-03-17 19:19:14 +0300 |
|---|---|---|
| committer | namilsk <namilsk@namilsk.tech> | 2026-03-17 19:19:14 +0300 |
| commit | 0d8f7c437399531d700c2e01b4e0b33ba72bd689 (patch) | |
| tree | 57677d4efa4766b19dda5da6354674cf7ef77d0c /src/geoparsers/toml.rs | |
| parent | b2e7bb0317cd75946c275620de0aa9e579c0fae5 (diff) | |
Working on IP geo parsers && packet router
Diffstat (limited to 'src/geoparsers/toml.rs')
| -rw-r--r-- | src/geoparsers/toml.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/geoparsers/toml.rs b/src/geoparsers/toml.rs new file mode 100644 index 0000000..3638aa7 --- /dev/null +++ b/src/geoparsers/toml.rs @@ -0,0 +1,15 @@ +use crate::config::Config; +use crate::geoparsers::geoip2::Rules; + +pub fn parse_rules(config: Config) -> Result<Option<Rules>, Box<dyn std::error::Error>> { + let data = match std::fs::read_to_string(config.routing) { + Ok(result) => result, + Err(_) => { + println!("Couldnt find your `rules.toml`; Using default mode. All to anonymizers"); + return Ok(None); + } + }; + + let rules: Rules = toml::from_str(&data)?; + Ok(Some(rules)) +} |
