Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.63 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.63 KB

IP-Getter

The minimum amount of python to get a service which will tell me my IP.

Why?

When behind a NAT and I need to know my WAN IP address I've used a variety of services to find out, both directly and through the ipgetter package from @phoemur.

But, that ipgetter package from phoemur is dead, as is the link above, and it's not on pypi anymore.

Besides, the 45 servers which ipgetter v0.6.0 made random use of were never particularly fast and they were all HTTP (no SSL!).

So, this is a simple, easy to deploy IP reporting service - giving you your own data management, using SSL, with API key authentication, and even within a VPC if you like.

I'm using it to tell my pyftpdlib based FTP server what its external IP is while it's behind NAT. But, you can use your own deployment of it to check your WAN IP anywhere.

Usage

Dependancies

Requires serverless framework so go install that with npm install serverless -g.

Deployment

Serverless is basically some opinions about how to structure a lambda function and a deployment framework for multi-cloud operators. This function deploys to AWS with sis deploy --stage production --region eu-west-1

Getting your IP

After deployment, sis will report back with an API_KEY and an HTTPS API_ENDPOINT.

curl -X GET \
  https://$API_ENDPOINT/production/ip-getter \
  -H 'x-api-key: $API_KEY'

Or you can use your favourite library to make that call from within your code.