Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siri Shortcuts integration for iOS #8

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

alessionossa
Copy link

@alessionossa alessionossa commented Feb 1, 2022

Add support for Siri Shortcuts (and the Shortcuts app) for iOS.

Three intents have been implemented:

  • GetPeers: get the list of peers' public keys in a specific tunnel. Is designed to be used in the Shortcuts app;
  • UpdateConfiguration: update the configuration of a tunnel. At the moment, only allows updating peers' Endpoint. Is designed to be used in the Shortcuts app;
  • SetTunnelStatus: activate and deactivate a tunnel. Is designed to be used in Shortcuts, with Siri and Siri Suggestions.

The configuration of the Intents Extension was done by looking at the configuration of the Network Extension.

Intents (actions) are fully functional on iOS 14.0+, I will test them on iOS 13 as soon as I can get a device with this iOS version since the Simulator is very limited in this case. Anyway, this integration does not alter the functionality of the app.

UPDATE 07/02/2022
Tested on iOS 12, donated Intents are working correctly (turn on and turn off tunnels). User configurable actions in the Shortcuts app are not available on this iOS version for third-party apps.

@swiftbird07
Copy link

Thank you! This is a good solution if your WireGuard server is behind a daily changing public IP and you use dynDNS to update the IP (WG does not resolve endpoint domains after the tunnel has been enabled).

@alessionossa
Copy link
Author

Thank you! This is a good solution if your WireGuard server is behind a daily changing public IP and you use dynDNS to update the IP (WG does not resolve endpoint domains after the tunnel has been enabled).

I needed this integration for the same reason basically: to update the Peers' Endpoint values that change often. On desktop, you can use wgctrl, but on iOS, there was no other way than to manually update the Endpoint field.

It all started with the great and detailed article WireGuard Endpoint Discovery and NAT Traversal using DNS-SD by Jordan Whited that I suggest you read if you need to reach a device behind NAT (or with a dynamic IP, without using third-party services).
To port Whited's solution to iOS, I will also release a very simple (free) app that will take care of getting updated Peers' Endpoints from your server. This
To port Whited's solution to iOS, I will also release (for free) a very simple app that will take care of getting the updated Peers' Endpoint from your server. It will integrate with Wireguard through the Shortcuts app and will be released as soon as the Wireguard update with Shortcuts integration will be available.

@swiftbird07
Copy link

Thank you! This is a good solution if your WireGuard server is behind a daily changing public IP and you use dynDNS to update the IP (WG does not resolve endpoint domains after the tunnel has been enabled).

I needed this integration for the same reason basically: to update the Peers' Endpoint values that change often. On desktop, you can use wgctrl, but on iOS, there was no other way than to manually update the Endpoint field.

It all started with the great and detailed article WireGuard Endpoint Discovery and NAT Traversal using DNS-SD by Jordan Whited that I suggest you read if you need to reach a device behind NAT (or with a dynamic IP, without using third-party services). To port Whited's solution to iOS, I will also release a very simple (free) app that will take care of getting updated Peers' Endpoints from your server. This To port Whited's solution to iOS, I will also release (for free) a very simple app that will take care of getting the updated Peers' Endpoint from your server. It will integrate with Wireguard through the Shortcuts app and will be released as soon as the Wireguard update with Shortcuts integration will be available.

That sounds very nice! When do you think the update will be available?

@alessionossa
Copy link
Author

I don’t know when the update will be available: the implementation is complete and ready to be merged, we now have to wait for the maintainers to review the changes, build the app and submit the update to App Store!

@jmshrv
Copy link

jmshrv commented Feb 11, 2022

Are you meant to send PRs here? The official repo is at https://git.zx2c4.com/wireguard-apple, but I don't see a clear way of submitting patches there

@alessionossa
Copy link
Author

Are you meant to send PRs here? The official repo is at https://git.zx2c4.com/wireguard-apple, but I don't see a clear way of submitting patches there

Ways to contribute are listed on the WireGuard website and I've done whatever needed to be done, in fact, the changes are already published in the main repository, in the dedicated branch. They just need to be merged into the main branch, but I think this can be done by @zx2c4 only.

@jmshrv
Copy link

jmshrv commented Feb 11, 2022

Oh, I didn't realise sorry :)

This PR is working great for me, by the way!

@noelhibbard
Copy link

noelhibbard commented Feb 17, 2022

This is a great addition! I sure hope it gets merged. I don’t know of any other VPN client on iOS with this level of Shortcut integration.

@alessionossa
Copy link
Author

alessionossa commented Apr 9, 2022

Update 23/02/2022, from maintainers:

There's quite a bit of iOS/macOS backlog. But I'll get to it (or [...] will) eventually.

@houmie
Copy link

houmie commented Aug 9, 2022

It has been six months, I hope this gets merged. 👍🏼 It's very useful to have.

@alessionossa
Copy link
Author

Since Apple is releasing a new framework for the integration with Siri and the Shortcuts app - App Intents - I think it makes sense to rewrite this integration with the new framework. Otherwise, we start supporting a new functionality with a framework that is almost deprecated.

@MattGeale
Copy link

Since Apple is releasing a new framework for the integration with Siri and the Shortcuts app - App Intents - I think it makes sense to rewrite this integration with the new framework. Otherwise, we start supporting a new functionality with a framework that is almost deprecated.

I know that they're [apple] still working on the new Framework with new features still to be added, but would this be a relatively quick deployment to production since some of the work appears to have already been done? Thanks!

@Willianlike
Copy link

Actual problem 😄 need to merge and publish application

@alessionossa alessionossa marked this pull request as draft October 20, 2022 10:54
@zx2c4
Copy link
Member

zx2c4 commented Feb 8, 2023

Wondering why this is marked as a draft? Should I hold off reviewing this?

@alessionossa
Copy link
Author

Wondering why this is marked as a draft? Should I hold off reviewing this?

@zx2c4 Yes, I would like to reimplement the integration using the new AppIntents framework.

The biggest benefit is that we don’t need to open the app anymore to update the configuration because the code of App Intents can be in the Main App Target too.

@kz159
Copy link

kz159 commented Mar 15, 2023

Hi!
is there any progress on it everyone?

@noelhibbard
Copy link

Could we get it merged in its current state and then follow up later with a new version using the newer App Intents API? I've been waiting for the ability to connect to a VPN via a Siri Shortcut for years now and I feel it was right at our fingertips.

@alessionossa
Copy link
Author

Seeing the demand for this feature, I'll try to take a look at this today.

Could we get it merged in its current state and then follow up later with a new version using the newer App Intents API? I've been waiting for the ability to connect to a VPN via a Siri Shortcut for years now and I feel it was right at our fingertips.

This can be done, but would add a lot of boilerplate code that is more or less already outdated.

@alessionossa
Copy link
Author

alessionossa commented Apr 11, 2023

Here is a demo on iOS of the implementation am submitting for review

RPReplay_Final1681252092.MP4

TheApp Intents are available and correctly working with macOS app too

Screenshot 2023-04-12 at 00 33 41

Currently, the App Intents are localized in English only, however they are ready for localization in other languages since all the Strings are in AppIntents.strings file. It has been decided to keep a different file for AppIntents localization due to the nature of AppIntents that are separate from the rest of the app and to make it easier in the future to eventually move the AppIntents to a dedicated Extension.

@alessionossa alessionossa marked this pull request as ready for review April 11, 2023 22:34
@Marvur
Copy link

Marvur commented Apr 29, 2023

@alessionossa Some of WireGuard iOS users are on versions lower than 16.4 due to certain compatibility reasons. Connect/Disconnect feature in this implementation would be a great boon for us!

@alessionossa
Copy link
Author

@alessionossa Some of WireGuard iOS users are on versions lower than 16.4 due to certain compatibility reasons. Connect/Disconnect feature in this implementation would be a great boon for us!

@Marvur the framework used for the implementation is only available starting from iOS 16. Are there really big differences in compatibility between iOS 16.0 and iOS 16.4, considering they are in the same major release?

Anyway I think this PR is ready for review, and other Shortcuts actions can be discussed and implemented later.

@Marvur
Copy link

Marvur commented May 26, 2023

@alessionossa Some of WireGuard iOS users are on versions lower than 16.4 due to certain compatibility reasons. Connect/Disconnect feature in this implementation would be a great boon for us!

@Marvur the framework used for the implementation is only available starting from iOS 16. Are there really big differences in compatibility between iOS 16.0 and iOS 16.4, considering they are in the same major release?

Anyway I think this PR is ready for review, and other Shortcuts actions can be discussed and implemented later.

Users on iOS 16 - 16.1.2 are the target group. "Connect VPN" shortcut action doesn't exist on these versions of iOS and it will be super helpful to have that inbuilt in Wireguard.

@adriah
Copy link

adriah commented Nov 22, 2023

Is there anything holding this PR back? Would be really useful to have this one merged!

@alessionossa
Copy link
Author

Is there anything holding this PR back? Would be really useful to have this one merged!

The PR is just waiting @zx2c4 review I think; but he has been prioritizing other platforms and repository for some time.

@yur1xpp
Copy link

yur1xpp commented Jan 9, 2024

I needed this so bad for the fact that my ISP uses dynamic IP, would really appreciate if @zx2c4 could take some time review/merging this.

@HuJK
Copy link

HuJK commented Mar 5, 2024

Any updates? I need this!
I have to switch to different vpn on different wifi, current wireguard can't do this.

@alessionossa
Copy link
Author

Any updates? I need this! I have to switch to different vpn on different wifi, current wireguard can't do this.

@HuJK while I’m also looking forward to this PR’s review, I think you can accomplish your goal using system’s actions in Shortcuts. In fact, the current implementation doesn’t have any action to turn VPN Configurations On/Off because there’s already a system’s action since iOS 16 dedicated to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.