Automatically connect to VPN

1,918 views
Skip to first unread message

emindeth

unread,
Jun 3, 2018, 5:46:28 PM6/3/18
to Automate
Hello,
how is it possible to connect/disconnect with an specific Vpn app as soon as I connect to a wifi network? Normally I'm using "Wireguard" but because of a wifi network I have to regulary use "IpVanish" so that my connection doesn't get blocked. So currently i have to manually change the vpn network which is annoying. I already tried to use the "app start" and "broadcast send" blocks but i dont have the programming knowledge to do it.
It would be really nice if someone could show me which blocks i have to use and what i need to enter so that each vpn disconnects and reconnects.


Henrik "The Developer" Lindqvist

unread,
Jun 3, 2018, 8:53:47 PM6/3/18
to Automate
You will have to find out if the Wireguard app supports automation, maybe as a Tasker plug-on, or via Intent.

gtr...@gmail.com

unread,
Sep 29, 2020, 4:14:22 AM9/29/20
to Automate
Hope it is OK to reply to this old question, its the only one that comes up with 'wireguard' when searched and I believe it may be possible to toggle tunnels now.

In the wireguard app there is now a setting to 'Allow remote control apps', where external apps may toggle tunnels My knowledge is just too limited to know how to even begin to test this. I have though got the 'Start app block' that opens wireguard and I see the list of my tunnels, so far that's all I can do.

I'm happy to spend time trying various ways to choose a tunnel and get it to toggle, could anyone point me in the right direction to get started?

Thank you

gtr...@gmail.com

unread,
Sep 29, 2020, 4:23:18 AM9/29/20
to Automate
PS Just to add I believe the required the required way is to use the following intents...

Intent: com.wireguard.android.action.SET_TUNNEL_UP

Intent: com.wireguard.android.action.SET_TUNNEL_DOWN

Intent extra: "tunnel" = "SOME_TUNNEL_NAME"

Would that help?

Henrik "The Developer" Lindqvist

unread,
Sep 29, 2020, 4:26:03 AM9/29/20
to Automate
The Extras should be: { "tunnel": "SOME_TUNNEL_NAME" }

gtr...@gmail.com

unread,
Sep 30, 2020, 2:50:27 AM9/30/20
to Automate
Thank you, working nicely now.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages