Commit aef9d7a
olicesx
fix(geoip): parse .dat with prost and fix merged network range computation
Replace the hand-written wire parser in load_from_dat_file (geoip.rs and
geoip_converter.rs) with Google's standard protobuf library (prost),
aligned with dae's pkg/geodata. The hand-written parser assumed fixed
field order, single-byte tags and no unknown fields; any .dat variant
silently produced wrong networks.
Fix host-mask computation in the CIDR merge path: !u32::MAX << n is 0,
so merged ranges collapsed to their start address, turning adjacent or
overlapping networks into wrong prefixes. Use u32::MAX.wrapping_shr(prefix)
for the host mask and align the merged start address to the covering
prefix's network boundary before constructing the network.1 parent e1536ac commit aef9d7a
6 files changed
Lines changed: 250 additions & 392 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
0 commit comments