gluetun
gluetun copied to clipboard
Change Region of running container
Hey, is it possible to change the region without stopping the container setting a new environment variable and starting it again?
Could it be done with a script inside the container?
Thanks for this. Cheers
It probably could not be changed that easily, it would have to go through the Golang entrypoint program.
I think I'm gonna develop a simple web ui + http server in the existing entrypoint to change settings once it's running, starting with changing region. However that may take me weeks to do. I will comment back once I start developing it.
Another ugly but quicker way would be to access an http route like /update?region=bla&isp=3339 but I'd like to avoid that if possible :smile:
Thanks for your quick response. That would be awesome. :)
@qdm12 - if at all possible, maybe add a way to select the vpn-provider region in the web controls. would be easier (for us ;) ) than editing the compose file each time and recreating...
Hi a quick update from my side; I'm a bit busy with other projects right now but will do that in the coming 4-12+ weeks, sorry for the wait. What's below is the steps i need to do (aka note to future self):
- First, there is already a quite complex run loop (for openvpn and unbound for now). I would need to simplify it and ideally put tinyproxy and shadowsocks into that loop (long)
- Write an API to interact with with the loop (quick)
- Write a frontend for the API (quick)
So essentially i need to do some plumbing in 1. :smile: I'll update here once I make some progress.
Little update, I have done 1: now all subprocesses (openvpn, unbound, etc.) are in a 'loop'. I'll add a few API endpoints (2) in the coming 1-2 weeks.
Any update on this? I need to change regions periodically and it would be helpful to call a localhost request to change the region or IP address. Willing to Paypal $200 to prioritize this feature. Let me know, thanks.
Sorry for the immense delay.
0bb320065ef42228a98a9a5f16a453eb0ebbd0fa adds support for patching any of the vpn settings at runtime, using the http control server on port 8000
.
You can get (all) the current settings with curl http://localhost:8000/v1/vpn/settings
, and you can patch the ones you want with for example:
curl -X PUT http://localhost:8000/v1/vpn/settings -H 'Content-Type: application/json' -d '{"Provider": {"ServerSelection": {"Countries": ["netherlands"]}}}'
Note this is not so well-tested, so patching some of the settings may break gluetun at runtime eventually (then please create another issue).
Let's keep this issue opened for now so you can play around with it. Once you're happy enough with it, I will document it in the wiki.
@qdm12: Sounds great!
Will this also work with custom OpenVPN configs? This would be really amazing.
@d4h0 I think you could bind mount multiple openvpn config files and change the config path via the api. If it's the same config file but with different ips, you could also (maybe) patch the openvpn EndpointIP which should override the remote ip you have in your config.
Thank you, @qdm12, I'll give that a try!
Thank you for this feature! Any way to just change the server? So the external IP can be updated without filtering anything
Hi I tried the curl command for PAI VPN and modify the regions. It comes back with a 200 OK status, but does not change the region. Is there another version of the API that I should be using?
Hi - I tried to use this command to adjust the openvpn hostname and it is not working. Can you let me know if I am sending the curl command the correct way?
curl -X PUT http://192.168.86.48:8000/v1/vpn/settings
-H 'Content-Type: application/json'
-d '{"Provider": {"ServerSelection": {"hostnames": ["xxx.xxx.vpn.com"]}}}'
Output that is returned:
settings left unchanged