-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix: Support VPN modes on MacOS without hacks with osascript #1644
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
base: main
Are you sure you want to change the base?
Conversation
they have no idea that XCode added folders
awesome work, hope would be merged soon! For now used automator script but it feels like a crunch. |
@0xConsumer @lymanjre @hiddify-com please take a look when possible |
@hiddify-com can you have a look pelase?) |
That is a great PR. |
@hiddify-com Thank you for your response! In that case, it might not make much sense, depending on how soon it will be ready. However, it might be worth merging as a temporary solution and switching to NE once it's ready. If you need any help with rewriting to NE, I'd be happy to assist with the Swift/Dart parts |
It would be great if you can make it under network extenstion similar to ios one |
I’ve added the
SingboxHelper
daemon agent, which registers on launch with privileged mode, allowing the VPN service to run smoothly without any hacks. To implement this, I added anotherSingboxService
implementation, which is enabled by default on macOS 13+ (and honestly, I didn’t bother with settings no one’s asked for). macOS 13+ is the minimum supported version for theSMAppService
daemons API, and while there’sSMBlessJob
, it’s deprecated—so who even cares about supporting outdated macOS versions? Just to be clear, the app still works on earlier macOS versions, I just didn’t feel like writing two different daemon registration flows for those ancient OS versions.Communication with the daemon is handled by
NSXPCConnection
, which is type-safe, secure, and fast. The daemon loads thedylib
, so now all functions inlibcore
run withsudo
rights, and the VPN mode just works™.There’s also another thing: since
libcore
expects aDartDL_API
, and Swift didn’t have that out of the box, I went ahead and created one. It’s mostly a bunch of stubs, semi-auto-generated from C++ headers (don’t judge me, I’m too lazy to finish the script and upload it, but it would be super easy, I swear). The only function that’s implemented so far isDart_PostCObject
, which receives different statuses from libcore.What else, code is type-safe, with all the necessary assertions, checks, and guards. It’s not the most readable thing in the world, but who cares if it solves the problem? And if anyone cares to tidy it up, it should be pretty easy to reorganize.