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

mmproxy: Make the daemon config file nicer

parazyd 2 лет назад
Родитель
Сommit
1929788105
2 измененных файлов с 30 добавлено и 11 удалено
  1. 18 6
      bin/darkfi-mmproxy/darkfi_mmproxy.toml
  2. 12 5
      bin/darkfi-mmproxy/src/main.rs

+ 18 - 6
bin/darkfi-mmproxy/darkfi_mmproxy.toml

@@ -1,9 +1,21 @@
-# darkfi-mmproxy daemon listen URL
-#listen = "http://127.0.0.1:3333"
+## darkfi-mmproxy configuration file
+##
+## Please make sure you go through all the settings so you can configure
+## your daemon properly.
+##
+## The default values are left commented. They can be overridden either by
+## uncommenting, or by using the command-line.
+
+[mmproxy]
+# darkfi-mmproxy daemon listen URL.
+# This is where XMRig can connect to with a daemon (solomining) endpoint.
+#rpc = "http://127.0.0.1:3333"
 
 [monerod]
-# Monero network to use (mainnet/testnet)
-network = "mainnet"
+# monerod RPC address.
+# This is the monerod endpoint which is proxied by mmproxy.
+#rpc = "http://127.0.0.1:18081"
 
-# monerod RPC address
-rpc = "http://127.0.0.1:18081/json_rpc"
+# Monero network to use (mainnet/testnet)
+# Used to validate miner reward addresses.
+#network = "mainnet"

+ 12 - 5
bin/darkfi-mmproxy/src/main.rs

@@ -45,18 +45,25 @@ struct Args {
     /// Configuration file to use
     config: Option<String>,
 
-    #[structopt(long, default_value = "http://127.0.0.1:3333")]
-    // mmproxy daemon listen URL
-    listen: Url,
-
     #[structopt(long)]
     /// Set log file output
     log: Option<String>,
 
+    #[structopt(flatten)]
+    mmproxy: MmproxyArgs,
+
     #[structopt(flatten)]
     monerod: MonerodArgs,
 }
 
+#[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
+#[structopt()]
+struct MmproxyArgs {
+    #[structopt(long, default_value = "http://127.0.0.1:3333")]
+    /// darkfi-mmproxy JSON-RPC server listen URL
+    rpc: Url,
+}
+
 #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
 #[structopt()]
 struct MonerodArgs {
@@ -166,7 +173,7 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         Ok(return_data)
     });
 
-    ex.spawn(async move { app.listen(args.listen).await.unwrap() }).detach();
+    ex.spawn(async move { app.listen(args.mmproxy.rpc).await.unwrap() }).detach();
     info!("Merge mining proxy ready, waiting for connections");
 
     // Signal handling for graceful termination.