SSL/TLS Support?
Is there anything planned for Mojo stdlib in terms of SSL/TLS? I'm thinking something like Golang's crypto/tls or Python's SSL socket wrapper
We want to add HTTPS support to Lightbug but for that would be good to know if the stdlib will include this functionality any time soon or if this has to be built by the community
Python documentation
ssl — TLS/SSL wrapper for socket objects
Source code: Lib/ssl.py This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both clien...
GitHub
HTTPS Support · Issue #20 · saviorand/lightbug_http
Is your feature request related to a problem? Please describe. Would be nice to be able to say that a website I made with this is "secure" (the s in HTTPS) Describe the solution you'd...
28 Replies
I think they won't intend to do it now, they still optimize core
I think getting basic networking in std first makes more sense. I’d ideally like an API that supports ktls since that can use hardware accelerators (many Intel Sapphire Rapids systems, all AMD EPYC processors, Cavium’s ARM servers (still popular), Mellanox NICs, etc).
what is ktls?😭
you really know how system working bro
😭
It’s quite literally my job to know about this kind of thing.
so as you said, we need wait until mojo support that* api to better internet access?
as i tested, socket lib from lightbug lib
speed slower than python
I want to go have some discussions with modular people about how networking is going to be done, and although python has an API I think we can offer a one that has the capability to support hardware accelerators much better. At a minimum, I don’t see any reason to not have an io_uring API that’s faked using a thread on other platforms to allow for most programs to have very good networking.
Lightbug is a barebones implementation, from what I saw the python http parser has had a lot more work put into it and that’s where most of the performance difference is.
u can join zoom
they are streaming
I have work so no.
I can message while waiting on compiles, but that is all.
Hi @a2svior confirmed there are no immediate plans to build those libraries at this stage. Suggestion was to call into C or Python libraries. If you build it in Mojo yourself that would be awesome!
As darkmatter__ mentioned, Mojo is currently focusing on optimizing its core rather than kernel APIs, making the API quite 'expensive' at the moment. Without these optimizations, it's challenging to achieve significant speed improvements.
please correct if me wrong
We don't have the engineering hours to invest into the wider ecosystem such as SSL/TLS right now, but would very much appreciate if the community builds it, and we'll be sure to promote it. We're heavily focused on high-performance kernels to enable the MAX engine if that's what you mean?
i mean on network, not max
Right, the priorities are shifting to make calling Mojo libraries from Python and C/C++ a great experience, so that those existing ecosystems including networking can be taken advantage of while we wait for it all to be built in pure Mojo.
yes, thats the only way for now
but still waiting for pure mojo
Do you mean calling Mojo from C or C from Mojo.
And I am guessing for Python it's calling Mojo from Python?
Mojo from C, and Mojo from Python yeah
Sorry, if I continue the discussion. Is there an easy way to do the reverse, call C from Mojo. In that case we can get to use all libraries built in C.
yes, but as i tested on my local machine, its slower than python like 3-5%
better calling c lib from mojo
Can I reach out in DMs ? Would be curious to try and reproduce/see if we can improve the performance for the use case/particular handler you're using
I'll second calling into C from Mojo. Even if it's very rough "We pass the header through clang until it gets to LLVM IR, then convert it to MLIR and dump it into a file", the community spends a lot of effort transcribing syscalls right now.
yeah using the external call function:
For an example of using dlhandle check out: https://github.com/modularml/mojo/blob/nightly/stdlib/src/python/_cpython.mojo
GitHub
mojo/stdlib/src/python/_cpython.mojo at nightly · modularml/mojo
The Mojo Programming Language. Contribute to modularml/mojo development by creating an account on GitHub.
Are there any plans for an equivalent to Rust's bindgen (I'm not expecting Zig's magic interop) in the near future?
While external_call works, it's often rather annoying to use and getting anything usable requires transcribing large sets of #defines since we're focusing on talking to libc and adjacent libs right now.
If there isn't, I may look into a path through some hacky processing on LLVM IR out of clang.
Importing C/C++ header files and using them directly with Mojo was discussed in the community meeting today as being potentially next year. It is on the roadmap here: https://docs.modular.com/mojo/roadmap#cc-interop
Thanks, looks like I'll investigate doing something horrible to clang.