Replies: 2 comments 5 replies
-
|
Answering your question directly, yes - nearly 3.7 billion lines of JSON for just IPv4 addresses aren't really practical: dumbproxy will be loading that too long on startup and memory consumption will be insane. Instead you can come up with aggregated CIDR prefixes mapped to countries. E.g.: {
"192.0.2.0/24": "ZZ",
...
}the resulting list won't be too large and dp scripting engine will chew it easily. Many years ago I converted geoip db like that for nginx with that C program: https://gist.github.com/Snawoot/7c6f0b2122b3ea7fcb35 With some adjustments it will do the trick for your case too. Now, matching part: you'll have resolved destination address inside proxy function, but map contains address prefixes. In order to check address against map you'll have to check it for presence of any prefix which could contain that IP address. E.g. for IP address |
Beta Was this translation helpful? Give feedback.
-
|
What do you think about idea to create another one dialer called
Need to add package https://github.com/oschwald/geoip2-golang. I'm not a Go developer, but I'd like to try implement this solution, if you agree and do not have any other suggestions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What is easiest way to integrate https://www.maxmind.com/ geo database into proxy?
The idea is to split traffic and choose upstream depending on destination web site, my country sites should outgone directly, but internation traffic thought another upstream.
Now I can do it with this way:
But I afraid, json will be prohibitively large.
Thanx in advance.
Beta Was this translation helpful? Give feedback.
All reactions