Yesterday our team released Portals, an open source Mac app built in Swift. It uses the Ockam Rust library to privately share TCP or HTTP services ...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for the article!!
Just to mention that this link is not working because of the braces 😉: dev.to/build-trust/(https://github...
Thank you so much for pointing that out. Just fixed it!
It’s great to see such an app being established with one of the 2 best programming languages available (some would say 3), unfortunate in 2023 we still have to rely on C for interoperability, imagine this would become Rust! 🤯
I know you guys have been working on this quietly for a while now @mrinal. So exciting to see it finally released.
Thank you @cemcneill, so glad you like it!
Mind blowing 🤯! Thank you for documenting your journey.
Thank you @proteusiq. So happy to hear that you liked it!
Portals is a cool app. @mrinal can you elaborate on the differences between Portals and ngrok?
@mattgreg Great question. Here's the key difference in behavior:
When you use ngrok your local service is exposed to the Internet which mean attackers on the Internet can try different ways to attack it and break into your computer. ngrok servers also terminate TLS and see your unencrypted application data.
When you use Portals, your service is not available on the Internet, it is ONLY exposed to your invited friends. Attackers from the Internet have no way of attacking it. Ockam servers cannot see or manipulate your application's data since it is end-to-end encrypted between your friend's computer and your computer.
Could you say a bit more about the memory management side since Swift is garbage collected and Rust is not? At the end of the day how is memory reclaimed?
Sure!
First, during swift toward rust interactions, we need to manually consider the scope of the validity of parameters: they will be valid only until the functions returns. Adding the async context on the rust side, we need to copy the parameters before returning the function to make sure we don't incur in any memory violation or use-after-free.
When it's rust calling swift instead, we make a similar consideration: parameters will be valid only until the function returns, subsequently, the allocated memory of structures needs to manually be freed.
What if you had used protobuf to generate the structures on the two sides ?
Would that have reduced some of your structure translation work (and made it safer perhaps)?
Hi @dev99 good question. I don't think protobuf is helpful here since there's no need to serialize the data. We can simply access them in-memory.
So you used Tauri v2 and found it not good ? v2 is getting close to beta now, so do you think they will get better or is it of fundamental nature ?