dcache/src/bin/main.rs

65 lines
1.8 KiB
Rust

/*
* mCaptcha - A proof of work based DoS protection system
* Copyright © 2023 Aravinth Manivannan <realravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use clap::Parser;
use dcache::start_example_raft_node;
use tracing_subscriber::EnvFilter;
//pub type DcacheRaft = Raft<DcacheTypeConfig, DcacheNetwork, DcacheStore>;
#[derive(Parser, Clone, Debug)]
#[clap(author, version, about, long_about = None)]
pub struct Opt {
#[clap(long)]
pub id: u64,
#[clap(long)]
pub http_addr: String,
#[clap(long)]
pub introducer_id: u64,
#[clap(long)]
pub introducer_addr: String,
#[clap(long)]
pub cluster_size: usize,
}
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
// Setup the logger
tracing_subscriber::fmt()
.with_target(true)
.with_thread_ids(true)
.with_level(true)
.with_ansi(false)
.with_env_filter(EnvFilter::from_default_env())
.init();
// Parse the parameters passed by arguments.
let options = Opt::parse();
start_example_raft_node(
options.id,
options.http_addr,
options.introducer_addr,
options.introducer_id,
)
.await
}