initial commit

This commit is contained in:
yggverse 2024-10-22 20:45:42 +03:00
parent 381a398de1
commit a7083852c3
22 changed files with 446 additions and 15 deletions

23
src/client/socket.rs Normal file
View file

@ -0,0 +1,23 @@
use gio::{prelude::SocketClientExt, SocketClient, SocketProtocol, TlsCertificateFlags};
pub struct Socket {
gobject: SocketClient,
}
impl Socket {
/// Create new `gio::SocketClient` preset for Gemini Protocol
pub fn new() -> Self {
let gobject = SocketClient::new();
gobject.set_protocol(SocketProtocol::Tcp);
gobject.set_tls_validation_flags(TlsCertificateFlags::INSECURE);
gobject.set_tls(true);
Self { gobject }
}
/// Return ref to `gio::SocketClient` GObject
pub fn gobject(&self) -> &SocketClient {
self.gobject.as_ref()
}
}