From fe40aee9ad81ed2cc880ff9d649af7d0082d1a4a Mon Sep 17 00:00:00 2001 From: nixo Date: Fri, 30 Oct 2020 22:31:18 +0100 Subject: [PATCH] update readme to current version --- Readme.org | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Readme.org b/Readme.org index d3c8b35..1617b1d 100644 --- a/Readme.org +++ b/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