Login
RemiGemini
Login

RemiGemini

RemiGemini is an extremely small and lightweight library for interfacing with the Gemini Protocol using the Crystal programming language. It includes classes that aid in the implementation of clients and servers.

Wanna support Remilia? Buy me a coffee on Ko-Fi, or support me through Liberapay.

Buy Me a Coffee at ko-fi.com Donate using Liberapay

How do I get set up?

You will need Fossil installed to clone this repo. You will also need Shards v0.17.1 or later. If you have an earlier version of Shards, you will need to to build the latest version manually.

Once you have these requirements, add this to your shard.yml:

dependencies:
  remigemini:
    fossil: https://chiselapp.com/user/MistressRemilia/repository/remigemini

Usage

Both of these examples are included in the root of the repository. Example client:

require "./src/remigemini"

RemiGemini::Client.get(ARGV[0], noVerify: true) do |resp|
  puts "Response Status: #{resp.status}"
  puts "Response message: #{resp.meta}"
  puts resp.body
end

Example server:

require "./src/remigemini"

if ARGV.size != 2
  abort("Usage: #{File.basename(PROGRAM_NAME)} <tls key> <tls cert>")
end

server = RemiGemini::Server.new do |request|
  if request.uri.path == "" || request.uri.path == "/"
    resp = RemiGemini::Client::Response.new("Hello, world!")
    resp.to_io(request.sock)
  else
    resp = RemiGemini::Client::Response.new(RemiGemini::StatusCode::NotFound, "Nothing yet :(")
    resp.to_io(request.sock)
  end
end

address = server.bind("localhost", ARGV[0], ARGV[1], port: 8069)
puts "Listening on gemini://#{address}"
server.listen

Development

Style info

I use a somewhat non-standard style for my code.

How do I contribute?

  1. Go to https://chiselapp.com/user/MistressRemilia/repository/remigemini and clone the Fossil repository.
  2. Create a new branch for your feature.
  3. Push locally to the new branch.
  4. Create a bundle with Fossil that contains your changes.
  5. Get in contact with me.

Contributors

Links and Licenses

RemiGemini is under the GNU Affero General Public License version 3.