| Crates.io | iproxy |
| lib.rs | iproxy |
| version | 0.3.1 |
| created_at | 2025-01-02 21:25:22.009316+00 |
| updated_at | 2025-01-07 15:02:30.680867+00 |
| description | Proxy server for IP geolocation. Use external services to get the geolocation of an IP address. |
| homepage | |
| repository | https://github.com/containerscrew/iproxy |
| max_upload_size | |
| id | 1501877 |
| size | 1,757,089 |
Built your own IPV4 geolocation database
Built with ❤ in Rust
Table of Contents generated with mtoc
So imagine that you want to start indexing public IPv4 geolocation data. There are paid services, others free but requiring registration, that offer this type of content. By consulting one of these services you will obtain the data you need.
I do not know exactly all the public services that offer this data, in my case I have used the public database of ip-api.com
Without this external service this tool does not work, it would be necessary to refactor and use another API and map the responses.
Other possible solutions (not implemented):
You will make a request to your API endpoint, for example, curl http://localhost:8080/1.1.1.1, and the API will first check if the data exists in the database. If it does not exist, it will retrieve the information from the external website mentioned above. The next time you query the same IP, the data will be retrieved from MongoDB, avoiding the external query.

API logs can be retrieved executing
docker logs -f iproxyonce the API is running. Plase visit the next step.
The setup is configured to work with docker-compose locally.
With this file located in the root of this repository, you will be able to change some parameters.
docker-compose| :warning: WARNING |
|---|
Before start the docker-compose, change the password for mongodb root user. Change it in config.toml and compose.yml. |
make compose-up-build
This will starts the iproxy container and mongodb and nginx-proxy.
You can install the binary using cargo:
cargo install iproxy
# Then run the command iproxy (config.toml is neccesary in the same dir)
curl http://127.0.0.1:8000/api/v1/1.1.1.1
curl http://127.0.0.1:8000/api/v1/health
make compose-down
cargo install cargo-watch systemfd
docker network create iproxy
make local-development
make local-development-down
Using mongodb compass you can visualize your data from the collection ips

Import data from localhost to mongodb atlas
Visit the official webpage https://www.mongodb.com/docs/database-tools/installation/installation/.
mongodump --uri="mongodb://admin:admin@localhost:27017/?maxPoolSize=20&w=majority"
This command will create a new dump/ directory with the backup
The uri of this command is the remote uri (mongodb atlas)
mongorestore --uri="mongodb+srv://USERNAME:PASSWORD@XXXXX.XXXX.mongodb.net/?retryWrites=true&w=majority" --db="ipfinder" --collection="ips" dump/iproxy/ips.bson
openssl dependency/me endpoint to retrieve user geolocation ip dataiproxy is distributed under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE.