Live data from Hacker News

I made a simple geolocation service

maxkostinevich.com

151–160 of 187 posts

Re: I made a simple geolocation service

#151
post #86
post #81

Earlier quoted context omitted.

Your service correctly returned the following data about my IP: "client": { "conn_speed": "broadband", "conn_type": "wifi", "proxy_description": "vpn", "proxy_type": "hosting" Is this what Fastly is thinking about my IP?

Yeah, that's coming from these four Fastly VCL variables: conn_speed: https://developer.fastly.com/reference/vcl/variables/geoloca... conn_type: https://developer.fastly.com/reference/vcl/variables/geoloca... proxy_desc: https://developer.fastly.com/reference/vcl/variables/geoloca... proxy_type: https://developer.fastly.com/reference/vcl/variables/geoloca... conn_type is interesting to me, I'm not sure how you would…

There is a good chance it's just https://dev.maxmind.com/geoip/geoip2/geoip2-connection-type-...

Re: I made a simple geolocation service

#152

I built a simple API using pure NGINX to get the IP address of a client, for times when I needed to ask a customer for his IP address; it was easier sending them a URL for a service I control, than explaining how they could get that information another way. Now I have been thinking about opening it up for more people because while there are a variety of these services out there, one more does not hurt — it already ex…

>is there any use-case for geolocation APIs that does not involve tracking users for shitty purposes?

Use my GEOIP and longitude and adapt your CSS to show me your content in nightmode when it is night time in my Longitude. That would be cool.

Re: I made a simple geolocation service

#153

Earlier quoted context omitted.

Thanks for sharing. This is a perfect example which proves lambda/serverless/cf worker are snake oils.

It's not. If under 10 million requests per month, serverless will be cheaper and safer Else if under 1 billion request per month, managed VPS will be cheaper If over hundred of billions of requests per month, anything else than on premise is probably an error. Then you have grey areas where you need to process. But for most small project, you cannot beat the lambda prices. Especially if you expect bursts.

But if I expect bursts, Lambda could potentially cost me a few thousand dollars in a day while my own instance could handle it fine for like $50. Even paying $50/mo over a few years would pay off in that case.

Re: I made a simple geolocation service

#154

Earlier quoted context omitted.

Sorry silly question, still learning. Can you talk about how your linode setup is? Do you report back the same fields?

It's just a normal linode running archlinux. There are very minimal tweaks to handle the new connection load. I should write a blog post about it. It has steadily gained more traffic over the years and hasn't need much care and feeding. The go code can be found here if you're interested, though it some of the ugliest code I've written. I made it when ifconfig.me was having load issues many years ago. https://github.c…

I love the simplicity. I'm sure I could find similar source code for similar services that is way over engineered and doesn't perform nearly as well. Do you serve this with a reverse proxy in front, or just as is? I'm assuming as is since you have the TLS configured right in the code, but I figure I'd ask.

Re: I made a simple geolocation service

#155
post #124

Earlier quoted context omitted.

My application is not browser-based. I’d like to set a system clock timezone via geoip only, without location lookup via wifi. On my more secure systems I have location services disabled and it’d be nice to have an accurate local time automatically.

I have a need for this too, and considering making a basic service for it.

https://blip.runway7.net/v2.beta should work for you, let me know if it doesn't?

Re: I made a simple geolocation service

#156
post #154

Earlier quoted context omitted.

It's just a normal linode running archlinux. There are very minimal tweaks to handle the new connection load. I should write a blog post about it. It has steadily gained more traffic over the years and hasn't need much care and feeding. The go code can be found here if you're interested, though it some of the ugliest code I've written. I made it when ifconfig.me was having load issues many years ago. https://github.c…

I love the simplicity. I'm sure I could find similar source code for similar services that is way over engineered and doesn't perform nearly as well. Do you serve this with a reverse proxy in front, or just as is? I'm assuming as is since you have the TLS configured right in the code, but I figure I'd ask.

Having a reverse proxy on the same machine effectively doubles the amount of connections and requires coping the request around. There is no practical benefit to a reverse proxy for this use case. So the go program is listening directly on the internet.

I do have the service behind CloudFlare, which is essentially a reverse proxy. The reason is for CloudFlare is non-obvious; it is deserves a blog post, and that is connection pooling.

If I have all the requests go back to the origin, the bottle neck is not the go code, but Linux opening and closing all those single use TCP sessions. CloudFlare creates around 100k persistent connections to the backend, but then just keeps them open. This makes Linux much happier.

The high connection count actually made the service unstable once: https://github.com/georgyo/ifconfig.io/issues/2

Re: I made a simple geolocation service

#157
post #98

Earlier quoted context omitted.

Indeed. Using another service and being a wrapper around it is not all that impressive. He is also using workers which makes his solution expensive. I run ifconfig.io which now gets just over a billion hits a day. It is basically an echo service, and it just parrots back what cloudflare tells it. But since I run it on linode, it costs me a whopping $40 dollars a month for 35 billion returns a month. Using workers wou…

Thanks for sharing. This is a perfect example which proves lambda/serverless/cf worker are snake oils.

If that’s your opinion I’d like to hear your rebuttal to this [1]. It’s hard to argue against actual numbers for an actual production app running at actual scale.

[1] https://www.troyhunt.com/serverless-to-the-max-doing-big-thi...

Re: I made a simple geolocation service

#158
MaxMind data accurate to the zip code level only about 30-60% of the time (as compared with what Google's Geolocation service will provide which is based off more data points than just IP address). Only use MaxMind if you're looking for region or country level accuracy.

Re: I made a simple geolocation service

#159
post #98

I applaud your efforts but it's disingenuous to title this how you "made a geolocation service" when you are just reading a field in someone else's geolocation service.

Indeed. Using another service and being a wrapper around it is not all that impressive. He is also using workers which makes his solution expensive. I run ifconfig.io which now gets just over a billion hits a day. It is basically an echo service, and it just parrots back what cloudflare tells it. But since I run it on linode, it costs me a whopping $40 dollars a month for 35 billion returns a month. Using workers wou…

Your service has a response time of 20-30ms (from one of my servers, at least). So on top of everything else it's faster than OP too. Great example!

Re: I made a simple geolocation service

#160

Earlier quoted context omitted.

Have you considered not including the entire bootstrap.css on the front page since you only use about 1% of it :)

I almost never do frontend work. I'll gladly take a PR if you want to make that one page faster and prettier. Though I don't want to make the build require yarn or other js/css compiler framework for a single page.

if you give me a github repo, ill see what I can do
Post reply on HN