Google Geocode API deny the request - NodeJS - json

I want a geocode a street address in NodeJS, but the the google API deny the request, because of the IP address. I have dedicated IP address on my server, I generated API key used this IP address. My request looks like this:
https.get('https://maps.googleapis.com/maps/api/geocode/json?address=MY_ADDRESS&key=MY_KEY', function(response){...........});
I registered my currently public IP address of my computer just for to try the API and if I send a request from my computer it is working fine.
I found the following instruction on google developer site:"Every API request is generated by software running on a machine that you control. Per-user limits will be enforced using the address found in each request's userIp parameter, (if specified). If the userIp parameter is missing, your machine's IP address will be used instead."
Does it mean that I can add userIp parameter like this?:
https.get('https://maps.googleapis.com/maps/api/geocode/json?address=MY_ADDRESS&key=MY_KEY&userIp=MY_IP', function(response){...........});
I tried this on as well, but still not working. Has anyone an idea what I doing wrong?

Well, I think it takes some time to active the rule after you set that up.
If you are using it to test your app, you can set a server key which allow the ip 0.0.0.0/0, which in other terms, any ip address.
and I do not think you can override the request ip address. thetest you're referring to is about Per-user limits.

Related

US IP address to my Google Cloud functions located in Asia

My service is calling a 3rd party service (binance api) and there is a geo location description for US IP addresses (they banned all US IPs). My deployment's region set to Tokyo but the 3rd party services still sees that my request is coming from the US. Is there any solution to get a local ip address to functions where it is located?
You can achieve this requirement by creating a static external IP address in the same region.
To achieve this go through this document which shows how to reserve IP address to a cloud function as it is mentioned clearly what you need to get
In some cases, you might want traffic originating from your function to be associated with a static IP address. For example, this is useful if you are calling an external service that only allows requests from explicitly specified IP addresses.
For more information you can go through this Thread

Public IP Address Works: Google Domain error "Took too long to respond"

I am using Google Compute Engine and have 3 clusters that are grouped that have given me a Public IP address that works.
I changed the name servers for my Google Domain to point to them as directions are listed here: https://cloud.google.com/dns/docs/quickstart
Problem: I am getting a "took too long to respond error".
Other Solutions I have tried:
Use A Record to forward to IP address
I can see that you are using Cloud DNS, I think you only need to complete your configuration.
If you want to continue using Cloud DNS you can follow the next steps:
Go to the DNS zone page in the Cloud Console.
Copy the server names and use it at your Google Domains
Or if you prefer you can work directly to with Google Domains, and you can follow this guide:
https://support.google.com/domains/answer/9211383?hl=en

What is the correct way to protect Google API key for Places service?

First of all I want to use Google Places API for autocomplete. I have created API key and it works fine. I make api calls from client so I need to protect or restrict it. I tried to use HTTP restriction, but it doesn't work with Places API. There are recommendation in the docs to use IP restriction but it requires that some proxy server to make api calls. So which way is right? Do I need proxy server with IP restriction to make api calls? Or is there some way to make secure api calls from client?
Normally, when you are calling the requests from the Client-Side, it should be restricted via HTTP referrers, and IP address restrictions are used when you are calling the requests from the server-side which has a static IP address. If you're calling from the Client-Side and your HTTP restrictions are not working, it will be best to file a support case via https://console.cloud.google.com/google/maps-apis/support in order to open personalized communication channel as this must be an isolated case and might have something to do with your configuration in your GCP console.
I would also recommend to check the sample HTTP restriction below:
example.com
*.example.com
These two will allow your API key to be used in all subdomains and paths in your website.

Load IP address with data coming from a GPS device

I want to have an IP address which when pinged will load all the data sent from a GPS device. The GPS device is configured to send data to an IP address and port. I need to run a server side script to read the data from that port and display it on the IP address. Does GCP provide a static IP address to be purchased and can I use Google Cloud functions or any other GCP tool to read data from that specific port and display it on that IP address? If yes, how could I go about doing this? And is there any other way to implement this using some other platform?
Does GCP provide a static IP address to be purchased
Yes, you can create a static public IP address in Google Cloud.
Public IP addresses are free when attached to running instances/services.
Reserving a Static External IP Address
can I use Google Cloud functions or any other GCP tool to read data
from that specific port and display it on that IP address?
You have not provided enough information to answer this part of your question.
Do not mix multiple topics into one question. Create separate questions. You will get more/better answers.

Detect whether public IP address is dynamic or static

There are several email servers refusing connections of clients with public dynamic IP addresses. For example many smtp servers receiving emails only accept connections to clients having static IP adresses to avoid spam emails which are directly sent from computers having dynamic IP addresses.
When I looked for answers using google I only found information saying it is impossible to distinguish between static/dynamic addresses. So how do the email servers do it? Are there any databases providing information for specific IP ranges?
Have a look at the MX records of t-online.de (one of the largest German email providers). Try to connect to mx00.t-online.de:25 using Putty (raw mode) on a computer having a dynamic IP address. The mail server immediately closes the connection and does not even allow the client to send any command, while a connection of a server having a static IP is not refused.
Or have a look at the following extract of a SMTP session:
220 mailin.rzone.de [joses mi173] ESMTP RZmta 29.19 ready
EHLO Home-PC
250-mailin.rzone.de [joses mi173] greets 87.179.163.89
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-PIPELINING
250-DELIVERBY
250-SIZE 104857600
250 HELP
MAIL FROM:<sender#example.com>
250 2.1.0 <sender#example.com> Sender ok
RCPT TO:<recipient#example.org>
550 5.7.1 87.179.163.89 is a dynamic IP
This is the email server for customers of Strato, a German hosting company, which also denies access to clients having a dynamic IP address. Email addresses have been changed. I used a recipient address which is acceptable for mailin.rzone.de, so there is no relay issue.
Also http://whatismyipaddress.com/blacklist-check states the following:
Just because the IP is listed with a particular blacklist does not
mean that you are sending spam, just that particular blacklist
suggests not to accept mail directly from that IP address. Most
residential Cable/DSL IP addresses that are dynamically assigned will
indicate that they are blacklisted, meaning you should be sending from
your ISP's mail server, not a mail server running on your own internet
connection.
This is probably the result of using a DNS blacklist based on ISP-provided information about which of their IP addresses are authorized to send email directly. See Spamhaus' Policy Block List for an example.
The information isn't independently discoverable. Participating ISPs must provide the DNSBL services with information about their network.
However, in the case of some of these lists, like Spamhaus, the information is queryable by the general public under certain conditions. You couldn't detect whether IPs are static or dynamic directly, but could still check any particular IP.
You mentioned that whatismyipaddress.com incorrectly lists your current IP address as static. Using their blacklist check tool with your IP, 87.179.190.52, I see that they currently incorrectly show it as unlisted by Spamhaus' PBL (among others). The IP I'm connecting from is both correctly described as dynamic, and listed in the PBL, hinting that that might be what they're basing their information on.
I believe those email servers you're referring to only do a reverse DNS check so as long as you have a PTR record for that IP address, I think it should be OK.
Bottom line, I don't think dynamic IP allocation is an issue with mail servers.
Regarding the question, the only way I can think of is by looking at the WHOIS information, there's a field called NetType. Obviously, you cannot rely on it but at least it can give you an idea if the ISP did provide that information.
Static/public ip addresses are listed by some ISP's as follows
123.123.123.4 static.yourisp.isfine.com
WHILE dynamic are listed:
123.123.123.5 dhcp.mx1.coldservice.com
see?