update readme to current version
This commit is contained in:
parent
b03c65f782
commit
fe40aee9ad
34
Readme.org
34
Readme.org
|
@ -17,33 +17,33 @@ using Gemenon
|
|||
|
||||
Then, setup the SSL config
|
||||
#+begin_src julia
|
||||
ctx = Gemenon.OpenSSL.SSLContext()
|
||||
Gemenon.OpenSSL.ca_chain!(ctx, "./cert.crt", "./key.key")
|
||||
const verify_callback(preverify_ok, x509_ctx)::Cint = 1
|
||||
|
||||
Gemenon.OpenSSL.set_options!(ctx, Gemenon.OpenSSL.SSL_OP_NO_SSLv3)
|
||||
function init_ssl_context()
|
||||
ctx = Gemenon.OpenSSL.SSLContext()
|
||||
Gemenon.OpenSSL.ca_chain!(ctx, "./cert.crt", "./key.key")
|
||||
|
||||
verify_callback(preverify_ok, x509_ctx)::Cint = 1
|
||||
Gemenon.OpenSSL.set_options!(ctx, Gemenon.OpenSSL.SSL_OP_NO_SSLv3)
|
||||
|
||||
const accept_all = @cfunction(verify_callback, Cint, (Cint, Ptr{Cvoid}))
|
||||
|
||||
Gemenon.OpenSSL.set_verify_mode(ctx, Gemenon.OpenSSL.VERIFY_PEER, accept_all)
|
||||
accept_all = @cfunction(verify_callback, Cint, (Cint, Ptr{Cvoid}))
|
||||
|
||||
Gemenon.OpenSSL.set_verify_mode(ctx, Gemenon.OpenSSL.VERIFY_PEER, accept_all)
|
||||
ctx
|
||||
end
|
||||
#+end_src
|
||||
|
||||
You are ready to listen for connections! You can do this with a do block
|
||||
You are ready to listen for connections!
|
||||
You can do this like in Mux.jl
|
||||
|
||||
#+begin_src julia
|
||||
Gemenon.listen(ctx, verbose = true) do conn::Connection, request::Request
|
||||
cert = Gemenon.OpenSSL.get_peer_certificate(conn.client)
|
||||
if cert != C_NULL
|
||||
@info "This client is providing a certificate"
|
||||
end
|
||||
write(conn,
|
||||
Response(Status("20", "text/gemini"),
|
||||
"""
|
||||
@app test = (
|
||||
req -> document(req.conn, """
|
||||
# Welcome to Gemenon!
|
||||
|
||||
You can discuss about this on
|
||||
=> gemini://nixo.xyz/b/gemenon The Gemenon-Powered Board
|
||||
=> gemini://nixo.xyz/ The Gemenon-Powered Anonymous Board
|
||||
"""))
|
||||
end
|
||||
|
||||
serve(test, init_ssl_context, Gemenon.Sockets.ip"0.0.0.0", 1999)
|
||||
#+end_src
|
||||
|
|
Loading…
Reference in New Issue