Gemini julia server
Go to file
nixo 0f587b3464 readme.org: init 2020-10-23 11:25:16 +02:00
src Working version with some test 2020-10-23 11:13:35 +02:00
test Working version with some test 2020-10-23 11:13:35 +02:00
Manifest.toml Working version with some test 2020-10-23 11:13:35 +02:00
Project.toml Working version with some test 2020-10-23 11:13:35 +02:00
Readme.org readme.org: init 2020-10-23 11:25:16 +02:00

Readme.org

Gemenon.jl A Gemini Server

What is it

Gemenon.jl is a server for the gemini protocol.

It's written in Julia.

How to use

The usage is quite simple and similar to HTTP.jl

First, import the library

using Gemenon

Then, setup the SSL config

ctx = Gemenon.OpenSSL.SSLContext()
Gemenon.OpenSSL.ca_chain!(ctx, "./cert.crt", "./key.key")

Gemenon.OpenSSL.set_options!(ctx, Gemenon.OpenSSL.SSL_OP_NO_SSLv3)

verify_callback(preverify_ok, x509_ctx)::Cint = 1

const accept_all = @cfunction(verify_callback, Cint, (Cint, Ptr{Cvoid}))

Gemenon.OpenSSL.set_verify_mode(ctx, Gemenon.OpenSSL.VERIFY_PEER, accept_all)

You are ready to listen for connections! You can do this with a do block

  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"),
                     """
  # Welcome to Gemenon!

  You can discuss about this on
  => gemini://nixo.xyz/b/gemenon The Gemenon-Powered Board
  """))
  end