mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
initial commit
This commit is contained in:
parent
381a398de1
commit
a7083852c3
22 changed files with 446 additions and 15 deletions
23
src/client/socket.rs
Normal file
23
src/client/socket.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue