Europe regions still have US IP address, can I change this? - google-cloud-functions

I'm using Betfair's (sport betting) API and have put together some cloud functions to be triggered on certain events.
However, it seems that despite choosing a european region, in which it's legal to gamble online, the IP address of the server running the functions is in the US, so Betfair block any API request coming from the cloud function.
Is there any way I can guarantee that it comes from a european IP?
I did see an old post regarding this but hoping there's now an actual solution to it.
Thanks in advance.

Related

GCE Instance IP Address

I recently created a GCE instance in the "europe-west" zone.
Its intended to run an application that connects off to an external webservice.
When trying to login to the webservice I get an error about restricted region.
It turns out the webservice does not accept login requests from US regions.
I checked and even though my instance is in the "europe-west" zone, its associated IP is being reported as US.
Is there anything I can do to get a proper region IP or is there any way around this?
May need to abandon GCE if the answer is no...
Thanks
Robert
Reposting the answer from Gary Ling, product manager for external networking:
Thank you for posting the email. We are aware of this issue that
(almost) all Google IP addresses are SWIP'ed to be Mountain View, CA.
And at Google, it's not uncommon to remap a block of IPs from one
location to another, especially given the elasticity of IP addresses
for the Cloud. Too bad that many of external Geo IP services solely
depend on SWIP database. While we are evaluating what we can do to
help our customers, your best bet in my opinion is contacting your
API provider and explore options they may offer now.
To be more explicit, there are several ways that a Geo IP provider might determine the location of an IP address. Most of these probably won't work well with a global cloud provider like GCP.
Associate the IP with the region of the allocating internet authority. In this case, GCE has addresses mostly allocated from ARIN, the American Internet authority. Once allocated to Google, these addresses can be used in any location by managing routing rules on Google's internal network.
Associate the IP with the address of the registering company. In that case, the official address associated with all GCP IPs is the Google Mountain View headquarters, even for addresses used in Europe or Asia.
Use network distance measurements to determine where a subnet is located. This method is more expensive, because it requires sending active pings from multiple locations around the globe; typically the address is associated with the closest measurement node. This is a more accurate method, but requires running many well-connected nodes and sending a lot of internet traffic to, at a minimum, each /24 on the internet.
All IP address from the Google Cloud will always originate to US, particularly Mountain View City, because it is linked to Google HQ which is located there. I would like you to know that all data and hardware for your instance are located on specific data centers across the globe, depending on the location that you have selected. You may refer to this link [1] for reference. However, Google Public DNS uses the anycast routing to direct the packets to the closest DNS server geographically, so if you are assigning an IP address for any instance, Google's network will be aware that the IP address is on that zone, even if the IP address was originally from Mountain View, California. See this link [2] [3] for a detailed explanation. The reason that you see your instance's IP address originate from US is because the entire IP block is owned by Google and the ARIN information lists the address for the entire block to Google's HQ in Mountain View.
[1] https://groups.google.com/forum/#!searchin/gce-discussion/ip$20in$20us%7Csort:relevance/gce-discussion/otD1c6E-wWI/cvEDCUAlBAAJ
[2] Why do Google Cloud Platform static IP addresses list Mountain View, CA in reverse lookup regardless of region assignment?
[3] https://groups.google.com/forum/#!searchin/gce-discussion/us$20ip%7Csort:relevance/gce-discussion/RjzyHRBRujg/Fd21YlmOpzEJ

How is location determined from internet?

I was just installing Ubuntu and noticed it was downloading updates from ca.archive.ubuntu.com. How did it know I was in Canada? As far as I'm aware an IP packet carries no information regarding physical (geographcial location) and there is no stipulation in the Ethernet standard saying anything about information regarding location.
So how do things such as geolocation work? For example this website tells you which country your IP address belongs to. Is it just a matter of looking up an IP address in a table? If so where does the data come from, it's not as if people actively signup to have their IP address associated with the building address?
how does IP address geolocation work, does it just lookup the IP from a table?
Yes, that's exactly how it works.
IP geolocation is nothing more complicated than a database lookup. IP addresses are assigned by IANA to regional governing entities who then assign (sell) them to ISPs, governments and corporations (IBM for example has a dedicated block of IP addresses for themselves because they got into the internet game very early on).
Based on this fact we can sort of figure out where an IP address is located. IANA themselves publish the block level allocations on their site: https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml which is rendered beautifully in this XKCD comic: http://xkcd.com/195/.
As for the more detailed info like which city that IP address comes from, to get that information requires more data gathering. Some ISPs may tell you their assignment schemes, most dont. So most databases like whatismyipaddress.com painfully build theirs up by surveys (simply asking people where they are or via smartphone apps tapping into GPS), looking up whois databases (which may or may not lie) and careful guessing.
Yes, your IP carries a geolocation as well. I'm not sure that's the best way to describe it, as it doesn't really carry the information (I don't think?). This link gives a pretty good idea of the kind of details they can get from your ISP though:
http://whatismyipaddress.com/geolocation-accuracy
Of course all of that revealing information can be partially negated by using a proxy.

Geocoding for a directory

I need guidance on how to approach this problem.
I have a local directory which listings with addresses. I have been able to add geocode the address and save the latitude and longitudes. So far, no problem.
Now when the user searches in the directory, he/she will type in an address and then search for listings. The problem is I will need to geocode the search term(it will be an address/part of an address) and then search for listings.
Considering that the free geocoding limit is only 2500 requests per day, I will run out of the limit very soon every day.
Is there any other approach to this problem?
You could just use a different geocoder which doesn't have this limit.
For example there is Nominatim which uses data from OpenStreetMap. Although OSM's official Nominatim instance has a rather strict usage policy because it runs on donated servers you can just use a different instance, for example the one run by MapQuest. And if you want no restrictions at all then you can choose to run your own Nominatim instance.
Purchase a Maps API for Business License
http://www.google.com/enterprise/mapsearth/products/mapsapi.html
If you're dealing with US addresses, SmartyStreets sounds like it might be a good fit. We specialize in address verification and standardization, and we also return geocoding data (lat/lon) along with 40+ other data points, should you need them. Our Terms of Service are pretty open, unlike Google's (which doesn't let you use the geocode data for anything other than displaying on one of their maps); so you would be able to store and use the lat/lon in your own application. We have a jQuery plugin that can handle the address at point-of-entry, or you could use our API or our Lists service (especially useful if you have an accumulated list you want to process up front).
Our service also has an autocomplete feature that could cut down the time your users spend typing in addresses.

Getting the location of a user in AS3/Air app for mobile devices

I have an native app that I would like to store the location (just country would be fine) of where a user that logs into my app is from so I can customise some features for them.
I am using PHP as the backend. I have done some searching but nothing definitive found. Not sure how to get the IP of the device to be able to translate that to a location.
Thanks
I had to do this for my previous project. Best bet is not to rely on IP address, especially on mobile devices (my phone's IP currently has me somewhere in northern Utah when I'm actually in Phoenix). Use the GeoLocation API. That will give you the latitude, longitude position of a user which is generally fairly accurate. You can then use a GeoCoding service to determine what country they are in using reverse-geocoding. Google's GeoCoding API is fantastic and their terms were recently (April-ish) relaxed substantially making it much easier to use. I can also recommend Nominatim from OpenStreetMaps (their terms are pretty restrictive, but you can use MapQuest's Nominatim service which is pretty much free to be used however you want)
EDIT: As Pier mentioned, an ANE is required to use NetworkInfo on mobile. If you attempt to use it on mobile without the ANE, it will crash your app.
If you are set on using IPs, however, you can obtain it through the NetworkInfo class. NetworkInfo.networkInfo.findInterfaces() will give you a bunch of NetworkInterface objects. You'll be looking for InterfaceAddress. I do warn you, however, I have had difficulty in the past getting this method to work on mobile, especially iOS. Additionally, I cannot remember if it returns the network IP (i.e. 192.168.1.17) or the actual IP that is connected to the web. The local IP will obviously do you no good.
Did you look on http://www.ip2location.com/
You can use it in you php backend to translate ip to address
I would use geolocation if I were you. if its a mobile device you can use gps or cell tower (less accurate) to get their location, but if thats not an option for you and you dont have the capability of using a server-side technology like php, asp, etc. to get the ip easily, maybe this post will help: How to find the ip address in as3?

Blocking access for a given geographic location

What is the most reliable way to prevent users from a geographic location to access a web available application?
I understand that IPs are related to geo positioning and I also understand that the most naive way is to get the HTTP request header IP address and take it from there.
It's obvious that naive methods, like the one described are extremely easy to bypass, specially using Proxies or VPNs.
So the question is: is there a 100% reliable way of determining a web user geo location? If not, what are the available options and what are the pros and cons on each of them?
The short answer is no. There is no way to 100% lock down the people from a specific geographic location because you can't guarantee the location of a user that reliably using an IP address. Even if you could, it can be faked through redirects.
There are ways to make it more difficult for people in a region to access the site, but the more restrictive you get with those approaches the more legitimate users you are likely to lock out. For example, turning off the server would give you 100% assurance that no one from China could hit it, but it would also give you 100% assurance that no one in the US could either.
Nothing in TCP/IP includes location data (other than what you can infer from routing tables or look up in a database), and nothing indicates whether a machine is acting "on behalf of" someone in another location.
So as you say, proxies and VPN, SSH port-forwarding, TOR, etc, can completely prevent your web app from knowing the physical location of the human being who's using your site. All you can look up, is the IP address of that last hop which is the TCP/IP connection and HTTP request you actually see.
The above techniques won't work if anyone is trying to hide their location from you by redirecting through relays in other countries.
I found this script to be an easy way to implement this:
https://www.blocked.com/
Country blocking is included in the free version, as is blocking of open proxy servers, anonymity networks, etc.
There is a database somewhere on the tubes named IP 2 Country which can tell where an IP is from.
It is of course not perfect but it can give you the country where the ip comes from.
There is also a method called SSN which is related to ip addresses. I don't know how it works however, and seems to be rather complicated. It is comonly used in ads to send you localised spam. For example if you live in Montreal, Canada, then the ad will display "Find singles from Montreal!". The ISP behind the person does have to support this service.
first - figure out what ip groups are assigned to the region then you could check with every request for the user's ip address. If it matches part of the region you want to block then send them to disney.com.
See if this helps you: IP Address Info
No, there's no fool-proof way of doing this.
There's plenty of related work going on at the IETF in the GeoPriv working group, where protocols are being designed (e.g. HELD) to allow entities to ask the network their own location, and also allow other authorised entities to request that information.
However the VPN issue still causes problems, to the extent that clients with VPN capability need to request their location information before the VPN is established.