Looking for a VPN example or library

Hey there. I’m trying to figure out how to implement a VPN inside my code, my aplications run in one server which obviously has static IP, but one of the applications I need it to have dynamic IP, and I was thinkin’ about using a VPN to change de IP only internally i my application, I mean, the rest of the server keep with the original IP, but in my application I connect from a VPN. Is there any solution for that?

Thanks and best regards.

Without knowing what your application that needs to have a dynamic IP is trying to do, it’s hard to give concrete advice.

I have had some success using ssh to listen or dial from a remote server. Make an ssh connection with ssh.Dial, then use the ssh.Client you get in response to Listen or Dial the connections you need.

The default transport for http clients can be set with:

http.DefaultClient.Transport = &http.Transport{
	Dial: sshClient.Dial,
}

Listening (e.g., for an http server) must be done manually instead of using a ListenAndServe function.

1 Like

This application makes lots of Google reverse geocode api calls, and somtimes Google blocks my IP and it keeps not working til the next day, that’s why I’m thinkin about running my application inside a VPN to avoid this problem, I see it’s possible because I’ve seen a Google Chrome VPN extension which runs a background process allowing only Google Chrome navigate through the VPN, but if I open another software and search for myh public IP, it’s the original one, only inside chrome the IP is VPN’s. That’s exactly what I’m trying to figure out how to do, keep my network as it is, but inside my application it connects to the Internet using the vpn IP.

Why does Google block your IP?

Is the block really by IP and not your API key?

Are you caching results (and using the cache to avoid repeated api requests)?

3 Likes

I don’t use API key to do reverse geocode, there still are 2 ways to do that, with and without.

About caching results; yes I’m caching in the database.

Are you hitting a daily limit or a windowed limit (e.g., 50 req/second)? What response do you get when it starts failing?

2 Likes

Regardless what kind of limit he hits, circumventing it is probably against googles terms of use.

@leogazio you should give google some money to increase your quota.

3 Likes

Yes some thousand of dollars a year, that’s not what I came here to discuss, I cam here to ask about VPNs in go.

I guess daily.

No matter how you try to solve the problem, you need to figure why you are being blocked. It would be a shame to implement a complicated solution if you could have delayed some requests by a second.

Before looking for a solution I would:

  • read the API docs and find out acceptable usage limits
  • instrument the app to find out what it is using (one of these packages should work)
  • make sure the cache is working properly
  • check the response from the api when it is denying access to see if you can learn more
3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.