M
Modular5mo ago
a2svior

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
GnU So Cute
GnU So Cute5mo ago
I think they won't intend to do it now, they still optimize core
Darkmatter
Darkmatter5mo ago
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).
GnU So Cute
GnU So Cute5mo ago
what is ktls?😭
GnU So Cute
GnU So Cute5mo ago
you really know how system working bro 😭
Darkmatter
Darkmatter5mo ago
It’s quite literally my job to know about this kind of thing.
GnU So Cute
GnU So Cute5mo ago
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
Darkmatter
Darkmatter5mo ago
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.
GnU So Cute
GnU So Cute5mo ago
u can join zoom they are streaming
Darkmatter
Darkmatter5mo ago
I have work so no. I can message while waiting on compiles, but that is all.
Jack Clayton
Jack Clayton5mo ago
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!
GnU So Cute
GnU So Cute5mo ago
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
Jack Clayton
Jack Clayton5mo ago
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?
GnU So Cute
GnU So Cute5mo ago
i mean on network, not max
Jack Clayton
Jack Clayton5mo ago
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.
GnU So Cute
GnU So Cute5mo ago
yes, thats the only way for now but still waiting for pure mojo
viataram
viataram5mo ago
Do you mean calling Mojo from C or C from Mojo. And I am guessing for Python it's calling Mojo from Python?
Jack Clayton
Jack Clayton5mo ago
Mojo from C, and Mojo from Python yeah
viataram
viataram5mo ago
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.
a2svior
a2sviorOP5mo ago
Curious about the performance bit, but we can chat about somewhere else. According to benchmarks that other folks run (you can see in Lightbug's Discord or here we're faster than Python usually Alright, thanks! Sounds good
GnU So Cute
GnU So Cute5mo ago
yes, but as i tested on my local machine, its slower than python like 3-5% better calling c lib from mojo
a2svior
a2sviorOP5mo ago
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
Darkmatter
Darkmatter5mo ago
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.
Jack Clayton
Jack Clayton5mo ago
yeah using the external call function:
var uid = external_call["getuid", UInt32]()
var uid = external_call["getuid", UInt32]()
Jack Clayton
Jack Clayton5mo ago
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.
Darkmatter
Darkmatter5mo ago
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.
Jack Clayton
Jack Clayton5mo ago
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
Darkmatter
Darkmatter5mo ago
Thanks, looks like I'll investigate doing something horrible to clang.
Want results from more Discord servers?
Add your server