tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[feat] Document how to use system extensions with tauri?

Open elibroftw opened this issue 10 months ago • 6 comments

Describe the problem

We have a Tauri project, but it need to use the network system extension on macOS. We aren't so clear on how to do it.

Describe the solution you'd like

Either documentation or a sample project of how to do the following, either using Tauri or wry.

Alternatives considered

Planning on creating a swift app that uses wry and starts a webview.

Additional context

No response

elibroftw avatar Apr 26 '24 21:04 elibroftw

I have a tauri application that normally would need to use Apple's network extension framework because of the vpn tunnel, but I use a different approach: Compiling the openvpn source code into an executable binary file, and then using tauri to execute this binary file, and listening to the output content returned, is feasible on macos, I hope to help you a little

HQ222222 avatar Apr 28 '24 02:04 HQ222222

We need a little more than networks extension. We need sandboxing, custom entitlements, and provisioning profiles

I guess entitlements is covered here: https://tauri.app/v1/guides/building/macos/#application-bundle-customization

elibroftw avatar Apr 28 '24 03:04 elibroftw

i also want to do the same thing, now i use the sidecar binary and leverage utun interface to do the VPN, but it have limitations so it turns need to system extension method.

do not know the apple extension binary format, if it support exported to ffi interface, maybe we cound create the binary only in xcode and integration the binary to the tauri project.

some findings on the apple forum, seems the guy 's method can work https://forums.developer.apple.com/forums/thread/665667

fortitudepub avatar Jun 20 '24 11:06 fortitudepub

We are currently using swiftUI and then launching the frontend using WebKit. Apple allows injecting event handlers so we have bridged commands. I think you should try Tauri 2.0 but the reason we didn't is because it's not stable yet.

elibroftw avatar Jun 20 '24 12:06 elibroftw

We are currently using swiftUI and then launching the frontend using WebKit. Apple allows injecting event handlers so we have bridged commands. I think you should try Tauri 2.0 but the reason we didn't is because it's not stable yet.

Thanks a lot for sharing, by using WebKit you mean you can reuse some of the frontend code in javascript?

I also want to leverage the rust part code because it combine some ffi library to talking to the networking daemon, As I develop iOS app I think network extension is also a dedicated process where I can reuse the tauri javascript + rust part code; otherwise maintain a different macOS/iOS build seems to much work for me. will investigate later and post feed back here.

fortitudepub avatar Jun 21 '24 02:06 fortitudepub

Yeah we're reusing 99% of JavaScript code. We also interlope rust code but can't speak more on the architecture at the moment.

elibroftw avatar Jun 21 '24 03:06 elibroftw