Rust Code to Determine Public IP

Job ID: 38799730

Budget: €30 – €250 EUR

I'm using Linux Ubuntu 22.04 and need a Rust code that connects to a specified web server URL and retrieves the public IP of its router. The server is configured outside of DNS, hence the necessity of this task.

Key Requirements:
- The code should utilize the 'surf' Rust library. or tokio: or reqwest or hyper:
- It should effectively handle a router behind NAT and a router with dynamic IP.
- Connection timeouts should also be managed gracefully.

Please note that I may not have a mechanism to manually obtain the public IP, so if the code could incorporate this functionality, that would be beneficial. I have no sudo or admin rights, no ssh or other.

Ideal Skills:
- Proficiency in Rust programming language.
- Experience in working with Linux Ubuntu.
- Understanding of network protocols and IP addressing.
- Ability to handle edge cases in code.

Looking forward to your proposals.
Related categories: System Admin Linux Ubuntu Network Administration Rust