Gemini Server for the ESP8266 microcontroller
This repository has been archived on 2022-11-24. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
Go to file
-fab- f7a353b3d5 Changed from GPLv3 to permissive MIT LICENSE 2022-11-24 13:14:15 +01:00
data/gemini changed email address 2021-09-10 21:07:00 +02:00
.gitignore Initial commit 2021-02-12 18:42:30 +01:00
LICENSE Changed from GPLv3 to permissive MIT LICENSE 2022-11-24 13:14:15 +01:00
README.md Added info concerning Elliptic Curve SSL in README.md 2021-09-15 00:30:55 +02:00
config.dist.h Added support for Elliptic Curve Certs and made it default 2021-09-15 00:18:42 +02:00
esp8266-gemserver.ino Added support for Elliptic Curve Certs and made it default 2021-09-15 00:18:42 +02:00
makefile Changed filename of sketch in makefile due to renaming 2021-02-13 21:57:21 +01:00
request.cpp file_path and file_ext are now calculated Request Class 2021-03-02 08:37:30 +01:00
request.h file_path and file_ext are now calculated Request Class 2021-03-02 08:37:30 +01:00
splitstr.cpp Initial commit 2021-02-12 18:42:30 +01:00
splitstr.h Initial commit 2021-02-12 18:42:30 +01:00

README.md

esp8266-gemserver

A Gemini server for the ESP8266 microcontroller

This is a small private project only to tinker around with the ESP8266 microprocessor and it's at an very early stage. So you WILL run into bugs.

How to compile

  1. Set up your Arduino IDE for support of the ESP8266 microcontroller. Look at https://github.com/esp8266/Arduino .

  2. Install the ESP8266LittleFS tool into the "tools" folder in your Arduino sketchbook directory.

  3. Copy the "config.dist.h" file to "config.h" and edit it accordingly (Set Wifi Credentials, hostname, port and the TLS cert/key)

  4. Open the "esp8266-gemserver.ino" file in your Arduino IDE.

  5. Select your esp8266 board (e.g. "NodeMCU 1.0 (ESP-12E Module)") and set the flash size accordingly. Also set the speed of the ESP8266 to 160MHz in the settings! It won't work with the standard 80MHz speed!

  6. Compile the code. If there are no errors, upload it to your ESP8266 module

  7. Upload the LittleFS Structure (in the "data/" folder of the sketch) to the filesystem section of your ESP8266 module: Choose "tools -> ESP8266 LittleFS Data Upload" in your Arduino IDE.

  8. Connect to the Serial Monitor and send a request from your Gemini Browser to the associated Hostname.

You can also use the makeEspArduino makefile to compile the sketch. Adjust this file accordingly.

Example Content

Certificate / Key

PLEASE CHANGE the certificates/keys data in the config.h file to your own certificate. The provided certificate/key is only for testing compilation.

It is adviced to use a EC (Elliptic Curve) Cert/Key due to much faster SSL negotiation (EC ~500ms vs. RSA ~1800ms)

Gemini Pages

If you want to put your own gemini files on the server, you have to put them into the "data/gemini/" folder and flash the content to your ESP8266 LittleFS flash storage.

Problems / Bugs

TLS Session Resumption

It seems that the BearSSL Library for the ESP8266 doesn't support TLS Session Resumption for now, though otherwise stated. A TLS cache would speed the following connections significantly up (from ~1800ms to ~200ms (RSA)).

I'm not sure how to work around this at the moment, maybe it's possible to use a different library, don't know.

Path and file path

For now all filenames should have a file extension and no other dot in the whole path except the one before the extension. E.g. "gemini://gemini:1965/pages/about.gmi". Otherwise the result is NOT SURE. Maybe the file gets served as octet-stream or maybe the server returns an error.

Paths like "gemini://gemini:1965/pages/" are allowed (with trailing '/'!!!) and 'gemini://gemini:1965/pages/index.gmi' is served if found, otherwise returns '51 File Not Found'.

If the last part of the path is a directory without trailing '/' then '50 Internal Server Error' will be sent by the server.

TODO

  • TLS Connection Resumption (TLS Cache)
  • Add support for different MIME types
  • Complete and fix resources path parsing
  • Lots of bugs to iron out
  • A lot more ...