-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
PreUp/PreDown PostUp/PostDown #24
Comments
Hi, can you explain this feature more? |
PreUp Optionally run a command before the interface is brought up. This option can be specified multiple times, with commands executed in the order they appear in the file. Examples Add an IP route PreUp = ip rule add ipproto tcp dport 22 table 1234 More examples: https://github.com/pirate/wireguard-docs |
Gotcha. So it seems these are additional configuration options you can add to the interface block in your VPN config file. It looks like these are only supported in the CLI and not the wireguard-android library (which this app uses). This is still a feature that could be added from scratch to this app but I would need more direction on the most valuable use case(s). What is your specific use case? |
Use case:
Just now this case looks like this:
|
Gotcha! So for this use case, because we are within the context of an Android app, we wouldn't be able to run these command line tool commands within our app itself. We could accomplish this by sending and intent to Termux. We would then wait before starting our tunnel connection. Although I can see this being useful, I feel like this is may be something better suited for an app like Tasker or Automate. I've recently added dynamic shortcuts to the app for each added tunnel. I did this specifically for automation integration purposes. We could add this functionality into the app itself if the benefit is there. I do think something like webhook integration could also be an interesting additional use case (although I'm not sure if people would find it beneficial). What are your thoughts? |
@romkazor I do still think this would be a cool feature. It would be a decent amount of work to get it working but I do see the benefits. Is there anything you are confused about that I can explain in more detail? |
Can these dynamic shortcuts be used in macrodroid? Macrodroid can't see them. Are there any intents we can send to enable the tunnels? Is this documented anywhere? |
So I've looked into this and I think I would consider this a bug even though I think it is technically not a bug. This should be possible, but I think because we are using dynamic shortcuts instead of static shortcuts these apps can't seem to find the WG Tunnel shortcuts. If this is the case, I may want to switch to static shortcuts instead of dynamic ones. I will do some testing on this. |
I've made a separate issue for this bug #38 |
Thank you! |
@rpgdev I ended up having to remove dynamic shortcuts and opt for static shortcuts as they seem to integrate much better with automation software. You can now use the static shortcuts to toggle your primary tunnel in release 3.1.0. This can be accomplished with a combination of Macrodroid and Shortcuts Maker. |
@zaneschepke I just updated and installed shortcuts maker but it isn't clear how to use shortcuts maker to make a shortcut to the tunnel in wg tunnel. Is this documented anywhere? |
I saw a video somewhere on how to do it. Mscrodroid > Actions > Launch shortcut > Select shortcut (this is what links to shortcut maker and you will recognize app icon) > (it has now redirected to shortcut maker) Inner Link > and now you can see the shortcuts for WG Tunnel here. |
Hi, is there any progress on implementing PostUp/PostDown? That's the only reason I need to move away from the official app. I hoped to find it here, but unfortunately, this app does not support this either. The reason I would need PostUp/PostDown on my rooted Android is to set up a custom route to a LAN of another peer connected to the same WireGuard network, without touching the server configuration. It works by manually typing these commands in a terminal, but it would be much more convenient to have it done automatically by the app itself. |
@Den41k92 if you're rooted is there any reason why tasker wouldn't work for this? I have since moved to tasker, mainly because of the wg support, it's very good now. You definitely could do post tasks after connecting or disconnecting from a wg network, all automatically. |
Unfortunately Tasker is not FOSS but I will look for an alternative. Thank you. |
No progress on this yet, but it seems that the appetite for this is relatively high so I could look to move it up in priority. |
I just wanted to tease a bit that I currently have this working in my dev env for both userspace and kernel mode (as long as you are on a rooted phone). A lot of the work was already done in this PR so it was actually a pretty simple one. Stay tuned! |
Please try out this feature here. There is not in app UI for editing config scripts, but you should be able to import and use them in kernel, userspace, and amnezia modes if you are using a rooted device. |
This feature is now live in the 3.5.0. It works on any rooted device whether you are in Amnezia, Kernel, or in the default WireGuard userspace mode! |
Awesome work, thank you very much! I've already tested and indeed adding and removing static routes with |
Great to hear! Eventually, I'll add some fields to edit these in app. |
Hello, how about this useful features?
The text was updated successfully, but these errors were encountered: