[server][client] Parse hostnames
This commit is contained in:
parent
90142ec5c1
commit
62b9d544f2
2 changed files with 7 additions and 6 deletions
|
@ -18,8 +18,8 @@ use coffer_common::coffer::{CofferShard, CofferValue};
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(StructOpt, Debug)]
|
||||||
struct Args {
|
struct Args {
|
||||||
/// Address of the coffer server
|
/// Address of the coffer server
|
||||||
#[structopt(short, long, parse(try_from_str), env = "COFFER_SERVER_ADDRESS", default_value = "127.0.0.1:9187")]
|
#[structopt(short, long, env = "COFFER_SERVER_ADDRESS", default_value = "127.0.0.1:9187")]
|
||||||
server_address: SocketAddr,
|
server_address: String,
|
||||||
|
|
||||||
#[structopt(short, long, parse(from_os_str), env = "COFFER_CLIENT_CERTIFICATE", hide_env_values = true)]
|
#[structopt(short, long, parse(from_os_str), env = "COFFER_CLIENT_CERTIFICATE", hide_env_values = true)]
|
||||||
certificate: PathBuf,
|
certificate: PathBuf,
|
||||||
|
@ -39,7 +39,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let cert = Certificate::new_from_cbor(&args.certificate)?;
|
let cert = Certificate::new_from_cbor(&args.certificate)?;
|
||||||
|
|
||||||
debug!{"Connecting to coffer server"}
|
debug!{"Connecting to coffer server"}
|
||||||
let mut stream: TcpStream = TcpStream::connect(&args.server_address)?;
|
let mut stream: TcpStream = TcpStream::connect(args.server_address)?;
|
||||||
|
|
||||||
debug!{"Sending hello"}
|
debug!{"Sending hello"}
|
||||||
let hello = framed(0x00, cert.public_key());
|
let hello = framed(0x00, cert.public_key());
|
||||||
|
|
|
@ -7,7 +7,6 @@ use std::path::PathBuf;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Read};
|
use std::io::{Read};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use std::net::SocketAddr;
|
|
||||||
|
|
||||||
use coffer_common::keyring::Keyring;
|
use coffer_common::keyring::Keyring;
|
||||||
use coffer_common::coffer::Coffer;
|
use coffer_common::coffer::Coffer;
|
||||||
|
@ -31,8 +30,10 @@ struct Args {
|
||||||
secrets: PathBuf,
|
secrets: PathBuf,
|
||||||
|
|
||||||
/// Address, the coffer server should bind to
|
/// Address, the coffer server should bind to
|
||||||
#[structopt(short, long, parse(try_from_str), env = "COFFER_SERVER_ADDRESS", default_value = "127.0.0.1:9187")]
|
#[structopt(short, long, env = "COFFER_SERVER_ADDRESS", default_value = "127.0.0.1:9187")]
|
||||||
address: SocketAddr,
|
address: String, // unfortunately we have to take a opaque string here,
|
||||||
|
// since we can't parse a hostname otherwise.
|
||||||
|
// Parsers are not customizable yet in structopt
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
Loading…
Reference in a new issue