bridge_updater_lib

Crates.iobridge_updater_lib
lib.rsbridge_updater_lib
version0.1.0
sourcesrc
created_at2024-07-26 06:30:29.338674
updated_at2024-07-26 06:30:29.338674
descriptionA helper library to get Tor bridges with ease.
homepagehttps://codeberg.org/quisgor/bridge_updater/src/branch/main/bridge_updater_lib
repositoryhttps://codeberg.org/quisgor/bridge_updater
max_upload_size
id1315857
size126,216
Quis Gor (quisgor)

documentation

https://docs.rs/crate/bridge_updater_lib

README

Bridge Updater Lib

Get Tor bridges with ease

A helper library made to retrieve bridge contents from The Tor Project's website. Designed to be integrated with GUI or terminal interfaces.

Example code:

use bridge_updater_lib::updater::Updater;
use std::{io::Write, fs::OpenOptions};

#[tokio::main]
async fn main() {
    if let Ok(mut upd) = Updater::new() {

        /* Retrieve captcha */
        if upd.retrieve_captcha().await.is_ok() {
            if let Some((_captcha_id, captcha_image)) = upd.captcha.clone() {
                let mut captcha_file = OpenOptions::new().write(true).create(true).truncate(true).open("captcha_image.jpg").unwrap();
                captcha_file.write_all(&captcha_image).unwrap();
                captcha_file.sync_all().unwrap();
            }
        }

        /* Retrieve bridges */
        let input_captcha = "ekGbudf";

        if upd.retrieve_bridges(&input_captcha).await.is_ok() {
            if let Some((bridges_text, bridges_qr)) = upd.bridges.clone() {
                println!("Bridges: {}", bridges_text);
                let mut qrcode_file = OpenOptions::new().write(true).create(true).truncate(true).open("bridges_qrcode.jpg").unwrap();
                qrcode_file.write_all(&bridges_qr).unwrap();
                qrcode_file.sync_all().unwrap();
            }
        }
    }
}
Commit count: 0

cargo fmt