Gemini julia server
Go to file
nixo db423191d9 fixup 2020-11-12 16:32:05 +01:00
src fixup 2020-11-12 16:32:05 +01:00
test tests: add more tests 2020-10-25 10:45:26 +01: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 fix broken example (missing server mode) 2020-11-01 21:09:48 +01: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

  const verify_callback(preverify_ok, x509_ctx)::Cint = 1

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

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


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

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

You are ready to listen for connections! You can do this like in Mux.jl

  @app test = (
      req -> document(req.conn, """
  # Welcome to Gemenon!

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

  serve(test, init_ssl_context, Gemenon.Sockets.ip"0.0.0.0", 1965)