qsocket

Crates.ioqsocket
lib.rsqsocket
version0.1.3
sourcesrc
created_at2023-03-12 12:46:10.515408
updated_at2023-10-25 16:13:41.941975
descriptionQSocket library.
homepage
repositoryhttps://github.com/qsocket/qsocket-rs
max_upload_size
id808013
size35,713
Ege Balcı (EgeBalci)

documentation

README

QSocket Rust

Build Status Coverage Status (codecov.io) Documentation

Rust library for qsocket...

Usage

Usage is really simple, qsocket_rs::new function simply creates a new quantum socket with given secret, it includes all the functions of standard std::net::TcpStream sockets and also implements io::Read/Write. After creating a socket you need to dial the QSRN network by calling qsocket_rs::Dial* functions. Simple example below...

use qsocket;

/// Creates a new quantum socket instance.
///
/// `secret` value can be considered as the password for the QSocket connection,
/// It will be used for generating a 128bit unique identifier (UID) for the connection.
let mut qsock = qsocket::QSocket::new("my-secret", true);

/// Opens a TLS connection to the QSRN.
///
/// If the `verify_cert` parameter is true,
/// after establishing a TLS connection with the QSRN gate server,
/// the TLS certificate fingerprint will be validated with the hardcoded certificate fingerprint value `QSRN_CERT_FINGERPRINT`.
///
/// If the connection fails due to network related errors,
/// function will return the corresponding error, in the case of
/// QSRN related errors the function will return one the ERR_KNOCK_* errors.
if let Err(e) = qsock.dial() {           
    panic!("{}", e);
}

After dialing the QSRN, socket is ready for read/write operations.

Commit count: 11

cargo fmt