4 ms·
Yes, actually, this is quite easy. Basically the I/O model uses cooperative coroutines. For TLS, you'll want to look at https://github.com/loladiro/GnuTLS.jl ht
by KenoFischer 13y ago
Yes, actually, this is quite easy. Basically the I/O model uses cooperative coroutines. For TLS, you'll want to look at https://github.com/loladiro/GnuTLS.jl https://github.com/loladiro/GnuTLS.jl. Then, after setting up the stream with the underlying socket, protocol information, etc. (see the README for how to specify this), you can just use it as any other IO stream...
# Set up stream `sock` here
@async begin
println(sock,"Hello World")
line = readline(sock)
println(sock,"You typed ",line)
end
Basically the encryption happens on the fly and the stream can be used just like any other socket. For example, in the http client code here: https://github.com/loladiro/Requests.jl/blob/master/src/Requests.jl#L197-L204 https://github.com/loladiro/Requests.jl/blob/master/src/Requ..., the only difference between HTTP and HTTPS is how the socket is set up, the actual reading and writing is the same. Hope that helps!