Glib/Gio-oriented network API for Gemini protocol
Important
Project in development!
GGemini (or G-Gemini) library written as the client extension for Yoda, it also could be useful for other GTK-based applications dependent of glib and/or gio (2.66+
) bindings.
Debian
sudo apt install libglib2.0-dev
Fedora
sudo dnf install glib2-devel
cargo add ggemini
use gio::*;
use glib::*;
use ggemini::client::{
connection::{
Request, Response,
request::Gemini,
response::meta::{Mime, Status}
},
Client, Error,
};
fn main() -> ExitCode {
Client::new().request_async(
Request::gemini(
Uri::parse(REQUEST, UriFlags::NONE).unwrap(),
),
Priority::DEFAULT,
Cancellable::new(),
None, // optional `GTlsCertificate`
|result: Result<Response, Error>| match result {
Ok(response) => {
// route by status code
match response.meta.status {
// is code 20, handle `GIOStream` by content type
Status::Success => match response.meta.mime.unwrap().value.as_str() {
// is gemtext, see ggemtext crate to parse
"text/gemini" => todo!(),
// other types
_ => todo!(),
},
_ => todo!(),
}
}
Err(e) => todo!("{e}"),
},
);
ExitCode::SUCCESS
}
- to send requests using Titan protocol, see
titan_request_async
implementation
- ggemtext - Glib-oriented Gemtext API