Просмотр исходного кода

bin: Remove obsolete gatewayd.

parazyd 4 лет назад
Родитель
Сommit
5541aafcac
4 измененных файлов с 0 добавлено и 156 удалено
  1. 0 1
      Cargo.toml
  2. 0 25
      bin/gatewayd/Cargo.toml
  3. 0 24
      bin/gatewayd/gatewayd_config.toml
  4. 0 106
      bin/gatewayd/src/main.rs

+ 0 - 1
Cargo.toml

@@ -24,7 +24,6 @@ members = [
 	"bin/darkfid2",
 	"bin/drk",
 	"bin/faucetd",
-#"bin/gatewayd",
 	"bin/ircd",
 	"bin/dnetview",
 	"bin/daod",

+ 0 - 25
bin/gatewayd/Cargo.toml

@@ -1,25 +0,0 @@
-[package]
-name = "gatewayd"
-version = "0.3.0"
-edition = "2021"
-
-[dependencies.darkfi]
-path= "../../"
-features = ["node"]
-
-[dependencies]
-# Async
-smol = "1.2.5"
-async-std = "1.11.0"
-async-channel = "1.6.1"
-async-executor = "1.4.1"
-easy-parallel = "3.2.0"
-
-# Misc
-clap = {version = "3.1.12", features = ["derive"]}
-log = "0.4.16"
-num_cpus = "1.13.1"
-simplelog = "0.12.0"
-
-# Encoding and parsing
-serde = {version = "1.0.136", features = ["derive"]}

+ 0 - 24
bin/gatewayd/gatewayd_config.toml

@@ -1,24 +0,0 @@
-## gatewayd configuration file
-##
-## Please make sure you go through all the settings so you can configure
-## your daemon properly.
-
-# The endpoint where gatewayd will serve its protocol API
-protocol_listen_address = "127.0.0.1:3333"
-
-# The endpoint where gatewayd will serve its publisher API
-publisher_listen_address = "127.0.0.1:4444"
-
-# Whether to listen with TLS or plain TCP
-serve_tls = false
-
-# Path to DER-formatted PKCS#12 archive. (Unused if serve_tls=false)
-# This can be created using openssl:
-# openssl pkcs12 -export -out identity.pfx -inkey key.pem -in cert.pem -certfiles chain_certs.pem
-tls_identity_path = "~/.config/darkfi/gatewayd_identity.pfx"
-
-# Password for the created TLS identity. (Unused if serve_tls=false)
-tls_identity_password = "FOOBAR"
-
-# Path to database
-database_path = "~/.config/darkfi/gatewayd.db"

+ 0 - 106
bin/gatewayd/src/main.rs

@@ -1,106 +0,0 @@
-use std::{net::SocketAddr, path::PathBuf, sync::Arc};
-
-use async_executor::Executor;
-use clap::{IntoApp, Parser};
-use easy_parallel::Parallel;
-use log::debug;
-use serde::{Deserialize, Serialize};
-use simplelog::{ColorChoice, TermLogger, TerminalMode};
-
-use darkfi::{
-    blockchain::{rocks::columns, Rocks, RocksColumn},
-    node::service::gateway::GatewayService,
-    util::{
-        cli::{log_config, spawn_config, Config},
-        expand_path, join_config_path,
-    },
-    Result,
-};
-
-/// The configuration for gatewayd
-#[derive(Serialize, Deserialize, Debug)]
-pub struct GatewaydConfig {
-    /// The address where gatewayd should bind its protocol socket
-    pub protocol_listen_address: SocketAddr,
-    /// The address where gatewayd should bind its publisher socket
-    pub publisher_listen_address: SocketAddr,
-    /// Whether to listen with TLS or plain TCP
-    pub serve_tls: bool,
-    /// Path to DER-formatted PKCS#12 archive. (Unused if serve_tls=false)
-    pub tls_identity_path: String,
-    /// Password for the TLS identity. (Unused if serve_tls=false)
-    pub tls_identity_password: String,
-    /// Path to the database
-    pub database_path: String,
-}
-
-/// Gatewayd cli
-#[derive(Parser)]
-#[clap(name = "gatewayd")]
-pub struct CliGatewayd {
-    /// Sets a custom config file
-    #[clap(short, long)]
-    pub config: Option<String>,
-    /// Increase verbosity
-    #[clap(short, parse(from_occurrences))]
-    pub verbose: u8,
-}
-
-const CONFIG_FILE_CONTENTS: &[u8] = include_bytes!("../gatewayd_config.toml");
-
-async fn start(executor: Arc<Executor<'_>>, config: &GatewaydConfig) -> Result<()> {
-    let rocks = Rocks::new(&expand_path(&config.database_path)?)?;
-    let rocks_slabstore_column = RocksColumn::<columns::Slabs>::new(rocks);
-
-    let gateway = GatewayService::new(
-        config.protocol_listen_address,
-        config.publisher_listen_address,
-        rocks_slabstore_column,
-    )?;
-
-    Ok(gateway.start(executor.clone()).await?)
-}
-
-#[async_std::main]
-async fn main() -> Result<()> {
-    let args = CliGatewayd::parse();
-    let matches = CliGatewayd::command().get_matches();
-
-    let config_path = if args.config.is_some() {
-        expand_path(&args.config.unwrap())?
-    } else {
-        join_config_path(&PathBuf::from("gatewayd.toml"))?
-    };
-
-    // Spawn config file if it's not in place already.
-    spawn_config(&config_path, CONFIG_FILE_CONTENTS)?;
-
-    let verbosity_level = matches.occurrences_of("verbose");
-
-    let (lvl, conf) = log_config(verbosity_level)?;
-
-    TermLogger::init(lvl, conf, TerminalMode::Mixed, ColorChoice::Auto)?;
-
-    let config: GatewaydConfig = Config::<GatewaydConfig>::load(config_path)?;
-
-    let ex = Arc::new(Executor::new());
-    let (signal, shutdown) = async_channel::unbounded::<()>();
-
-    let ex2 = ex.clone();
-
-    let nthreads = num_cpus::get();
-    debug!(target: "GATEWAY DAEMON", "Run {} executor threads", nthreads);
-
-    let (_, result) = Parallel::new()
-        .each(0..nthreads, |_| smol::future::block_on(ex.run(shutdown.recv())))
-        // Run the main future on the current thread.
-        .finish(|| {
-            smol::future::block_on(async move {
-                start(ex2, &config).await?;
-                drop(signal);
-                Ok::<(), darkfi::Error>(())
-            })
-        });
-
-    result
-}