mirror of
https://github.com/mimblewimble/mwixnet.git
synced 2025-01-20 19:11:09 +03:00
Merge pull request #30 from yeastplume/address_v2
Output server pubkey instead of onion address
This commit is contained in:
commit
d729087533
2 changed files with 7 additions and 7 deletions
|
@ -117,7 +117,7 @@ fn real_main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut server_config = config::load_config(&config_path, &password)?;
|
let mut server_config = config::load_config(&config_path, &password)?;
|
||||||
|
|
||||||
// Write a new config file if init-config command is supplied
|
// Write a new config file if init-config command is supplied
|
||||||
if let ("address", Some(_)) = args.subcommand() {
|
if let ("pubkey", Some(_)) = args.subcommand() {
|
||||||
if !config_path.exists() {
|
if !config_path.exists() {
|
||||||
panic!(
|
panic!(
|
||||||
"No public address configured (Config file not found). {}",
|
"No public address configured (Config file not found). {}",
|
||||||
|
@ -125,15 +125,15 @@ fn real_main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let sub_args = args.subcommand_matches("address").unwrap();
|
let sub_args = args.subcommand_matches("address").unwrap();
|
||||||
|
let server_pubkey = server_config.server_pubkey();
|
||||||
if sub_args.is_present("output_file")
|
if sub_args.is_present("output_file")
|
||||||
{
|
{
|
||||||
//output onion address to file
|
//output server pubkey to file
|
||||||
let output_file = sub_args.value_of("output_file").unwrap();
|
let output_file = sub_args.value_of("output_file").unwrap();
|
||||||
let onion_address = server_config.onion_address();
|
std::fs::write(output_file, format!("{}", server_pubkey.to_hex()))?;
|
||||||
std::fs::write(output_file, format!("{}", onion_address))?;
|
println!("Server pubkey written to file: {}", output_file);
|
||||||
println!("Onion address written to file: {}", output_file);
|
|
||||||
} else {
|
} else {
|
||||||
println!("{}", server_config.onion_address());
|
println!("{}", server_pubkey.to_hex());
|
||||||
}
|
}
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ args:
|
||||||
subcommands:
|
subcommands:
|
||||||
- init-config:
|
- init-config:
|
||||||
about: Writes a new configuration file
|
about: Writes a new configuration file
|
||||||
- address:
|
- pubkey:
|
||||||
about: Outputs the public key of the server
|
about: Outputs the public key of the server
|
||||||
args:
|
args:
|
||||||
- output_file:
|
- output_file:
|
||||||
|
|
Loading…
Reference in a new issue