Is there any way to write the same CIDR to different countries in customized Country.mmdb file?
Loyalsoldier opened this issue · 4 comments
I want the same CIDR, eg 1.0.0.1/24
to be added to different countries US
and CN
in my customized Country.mmdb
file.
How can I do that?
I am not quite sure what you are asking. Each leaf node has a single record. It isn't possible for a node to have two records. However, that record may contain whatever you want, including an array of country codes.
Sorry for the confusion.
I use GeoLite2-Country.mmdb
file for web traffic routing. If the destination IP belongs to US
, that traffic goes through the first proxy; if belongs to Google
, it goes through the second proxy.
But the software I use can only read and parse GeoLite2-Country.mmdb
file, not the GeoLite2-ASN.mmdb
file. To achieve my use case, I need to extend the official GeoLite2-Country.mmdb
file to include Google's CIDRs to a fake country called Google
.
As we all know, the IP 8.8.8.8
belongs to Google
and US
. Is there any way to keep 8.8.8.8
both in US
and the fake country Google
?
I would recommend just adding a new field to the record with the extra information you want. The country code is a string, not an array, but there is nothing stopping you from adding a new key with different data. You could have an array of countries as I mentioned in my first message, although that would break compatibility with GeoLite2-Country
.
thanks