ptth/src/bin/relay.rs

20 lines
482 B
Rust

use std::{
error::Error,
fs::File,
};
#[tokio::main]
async fn main () -> Result <(), Box <dyn Error>> {
use std::io::Read;
let mut f = File::open ("ptth_relay.toml").unwrap ();
let mut buffer = vec! [0u8; 4096];
let bytes_read = f.read (&mut buffer).unwrap ();
buffer.truncate (bytes_read);
let config_s = String::from_utf8 (buffer).unwrap ();
let config_file: ptth::relay::ConfigFile = toml::from_str (&config_s).unwrap ();
ptth::relay::main (config_file).await
}