Libgemini is a simple Gemini client library for Go, allowing you to interact with Gemini servers and retrieve content over the Gemini protocol.
Support for writing servers and gemtext parsing is on the roadmap.
- Supports a geminirc file as well as environment variables for controlling behavior.
- Simple and easy-to-use API for interacting with Gemini servers.
- 0 dependencies, only stdlib.
$ go get -u github.com/aalbacetef/libgemini
For a working example, see examples/simpleclient.
The geminirc is meant to be an analogue of the curlrc, but supported by libgemini.
This enables users to manage settings for apps using libgemini. It also makes development a bit simpler.
These settings can also be controlled with environment variables.
The default location for the geminirc file, in order, is:
- The location specified by the
LIBGEMINI_RC
environment variable. - $HOME/.config/libgemini/geminirc
If it is not found, the directory will be created and the file will be created.
To see a full example check data/geminirc
The following environment variables are supported:
LIBGEMINI_RC
LIBGEMINI_FOLLOW_REDIRECTS
LIBGEMINI_STORE_PATH
LIBGEMINI_DUMP_HEADERS
LIBGEMINI_TRACE
LIBGEMINI_INSECURE
See the below section for their usage.
Note: for boolean fields, uncomment to enable, comment to disable. Comments are set using '#'.
Env: LIBGEMINI_FOLLOW_REDIRECTS
Enable this option to automatically follow redirects.
--follow
Env: LIBGEMINI_TRACE
Dump the trace to a file. Set this option to the path of the file.
Note: that the file will be overwritten on each request.
--trace /tmp/libgemini-trace.txt
Env: LIBGEMINI_DUMP_HEADERS
Dump headers of last request to a file.
Note: that the file will be overwritten on each request.
--dump-headers /tmp/libgemini-headers.txt
Env: LIBGEMINI_INSECURE
Skip TOFU verification. Overrides --store.
--insecure
Env: LIBGEMINI_STORE_PATH
Set Store location.
--store ~/.config/libgemini/known_hosts
To use an in-memory store:
--store :memory:
If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.