zerotier / libzt

Encrypted P2P sockets over ZeroTier
https://zerotier.com
Other
185 stars 54 forks source link

Compiling `libzt` to `wasm`. #173

Open aarlt opened 2 years ago

aarlt commented 2 years ago

First of all, libzt is really awesome. It is a perfect match for a project that I have in mind for quite some time now. However, I was wondering whether it is somehow possible to compile libzt to wasm. Shouldn't this be somehow possible? Having libzt running in a browser would be quite awesome. Did anyone try yet? What would be needed to achieve this? Is there any showstopper?

I also found an old issue in the ZeroTierOne repository there this seem to be researched, it looks like that at least this was on the long-term road map: https://github.com/zerotier/ZeroTierOne/issues/684. Just linking the issue here.

MarshallRawson commented 1 year ago

I would also love to see this. I have attempted to compile libzt with emscripten, which is supposed to give a full POSIX env, but I always ran into linking errors. Until then, the best solution is probably to make an android app and emulate the android runtime in chromium with ARC.

p10tyr commented 8 months ago

I have tried to do the same thing in Blazor Standalone from .NET. I've installed the NuGet package and it wraps it all up into wasm libs

But sadly I get the error. It may be because of the way C# library wraps around the DLL and that's just not possible in WASM .NET??

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: libzt
System.DllNotFoundException: libzt

I am gonna try some more things but WASM is very new to me

--EDIT But the best way would be to compile libzt C source to WASM instead of all the wrappers