aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-geoip/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+2
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* geoip: Use tor-geoip-db as source of data.Nick Mathewson2026-04-161-14/+21
|
* geoip: Add export functionalityNick Mathewson2026-04-161-0/+60
| | | | | This is perma-unstable: We'll use it to make an export tool, but that's it.
* geoip: Mark CountryCode as repr(transparent)Nick Mathewson2026-04-161-0/+1
|
* geoip: Change CountryCode to NonZeroU16 internallyNick Mathewson2026-04-161-13/+20
| | | | | This lets us guarantee that every bit sequence is a valid Option<CountryCode>.
* geoip: rename internal get to get1.Nick Mathewson2026-04-151-2/+2
|
* geoip: Make asn data conditional.Nick Mathewson2026-04-151-49/+29
| | | | | | | | | | | | This abolishes the NetDefn type, and turns DenseRangeDb into a map to one or (optionally!) two types. For the DBs we ship, which don't have asn information, this saves about 2.5 MiB. (It also probably saves a bit more, since the niche optimization didn't apply to NetDefn as it existed before, since it tried to distinguish Some(None,None) from None.)
* geoip: Migrate code to DenseRangeMap.Nick Mathewson2026-04-151-27/+20
| | | | | This required correcting some errors in our previous ersatz geoip databases.
* geoip: Extract common line-parsing code.Nick Mathewson2026-04-151-47/+71
|
* geoip: Add new internal DenseRangeMap typeNick Mathewson2026-04-151-0/+1
| | | | | This type is more space-efficient than RangeInclusiveMap in the case where most ranges do not have gaps between them.
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* tor-geoip: Removed once_cell dependencyhashcatHitman2025-04-171-3/+2
| | | | | - [`once_cell::sync::OnceCell`] has been replaced by [`std::sync::OnceLock`], removing the need for the `once_cell` dependency.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* tor-geoip: Fix a doc warningIan Jackson2023-07-211-1/+1
| | | | | | | | | | | | cargo doc --locked --document-private-items --workspace --all-features warning: unclosed HTML tag `CountryCode` --> crates/tor-geoip/src/lib.rs:90:54 | 90 | /// We store these as NonZeroU8 so that an Option<CountryCode> only has to | ^^^^^^^^^^^^^ | = note: `#[warn(rustdoc::invalid_html_tags)]` on by default
* Merge branch 'cc_niche' into 'main'Nick Mathewson2023-07-201-5/+37
|\ | | | | | | | | geoip: Enable the niche optimization for CountryCode. See merge request tpo/core/arti!1384
| * geoip: Use from_raw_parts instead of transmute.gabi-2502023-07-131-1/+5
| |
| * geoip: Enable the niche optimization for CountryCode.Nick Mathewson2023-07-071-5/+33
| | | | | | | | | | | | | | | | Since we're going to be using `Option<CountryCode>` all over, let's save the extra byte. Sadly this required std::mem::transmute(), which is unsafe, so maybe we should think twice.
* | geoip: Add derive macros to GeoipDbjuga2023-07-181-0/+1
| | | | | | | | to be able to debug it, for instance.
* | geoip: Allow ASNs as zeros when creating NetDefnjuga2023-07-181-6/+2
| | | | | | | | | | | | | | so that GeoipDb can be created from files including ASNs generated with tor/scripts/maint/geoip/geoip-db-tool. Closes #961
* | Add country codes to relays inside a NetDireta2023-07-131-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | - When the `geoip` feature flag of `tor-netdir` is enabled, perform GeoIP lookups for all relays added to the directory and add the resulting country code to the `Relay` struct. - The GeoIP database is provided in a new `PartialNetDir::new_with_geoip` constructor. - A new trait was also added to `tor-linkspec`, `HasCountryCode`, to enable getting this data out from other crates. Part of onionmasq#47.
* | Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+2
|/
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* geoip: conditionalise a testIan Jackson2023-06-281-0/+1
| | | | | Without this, the build fails with cargo test --workspace --no-default-features --features=tokio,native-tls
* Merge branch 'stderr' into 'main'Alexander Færøy2023-06-211-0/+2
|\ | | | | | | | | lints: Promote clippy::print_stderr and clippy::print_stdout See merge request tpo/core/arti!1271
| * lints: Run maint/add_warning to actually apply new lints (again)Ian Jackson2023-06-211-0/+2
| | | | | | | | | | I prepared 161b9844d against an earlier version of main without the geoip crate. Run maint/add_warning again.
* | geoip: Add a few more tests.Nick Mathewson2023-06-201-1/+59
| |
* | geoip: Explain in more detail what a CountryCode is to us.Nick Mathewson2023-06-201-1/+14
| |
* | geoip: require that ccs actually are printable ascii.Nick Mathewson2023-06-201-3/+8
| | | | | | | | | | | | (There are plenty of strings that convert into 2 bytes of UTF8 without being two ascii characters, and there are plenty of sequences of two ascii characters that aren't printable.)
* | geoip: Make ?? a little more bullet-proofNick Mathewson2023-06-201-5/+46
|/ | | | We want to make sure that ?? is always None, never a CountryCode.
* tor-geoip: Add new crate with GeoIP database functionalityeta2023-06-201-0/+333
- This adds a new crate, `tor-geoip`, which can parse and perform lookups in the GeoIP database C-tor already uses (generated by a maintenance utility in the C-tor codebase). - We embed a copy of C-tor's databases with the crate and use `include_str!` to ship them with the binary, bloating its size somewhat. - This does, however, solve the problem of figuring out how to distribute these. - The plan is to gate this functionality behind a feature flag anyway, so the cost should be nil unless explicitly opted into. Part of tpo/core/onionmasq#47.