Merge pull request #61 from nymtech/feature/nym_client_lib

Feature/nym client lib
This commit is contained in:
Dave Hrycyszyn
2020-01-20 15:42:14 +00:00
committed by GitHub
7 changed files with 27 additions and 15 deletions
+4
View File
@@ -7,6 +7,10 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "nym_client"
path = "src/lib.rs"
[dependencies]
base64 = "0.11.0"
clap = "2.33.0"
+2
View File
@@ -0,0 +1,2 @@
// The file has been placed there by the build script.
include!(concat!(env!("OUT_DIR"), "/built.rs"));
-2
View File
@@ -1,11 +1,9 @@
use crate::banner;
use crate::persistence::pathfinder::Pathfinder;
use crate::persistence::pemstore::PemStore;
use clap::ArgMatches;
use crypto::identity::MixnetIdentityKeyPair;
pub fn execute(matches: &ArgMatches) {
println!("{}", banner());
println!("Initialising client...");
let id = matches.value_of("id").unwrap().to_string(); // required for now
-3
View File
@@ -1,4 +1,3 @@
use crate::banner;
use crate::clients::{NymClient, SocketType};
use crate::persistence::pemstore;
@@ -7,8 +6,6 @@ use crypto::identity::{MixnetIdentityKeyPair, MixnetIdentityPublicKey};
use std::net::ToSocketAddrs;
pub fn execute(matches: &ArgMatches) {
println!("{}", banner());
let id = matches.value_of("id").unwrap().to_string();
let port = match matches.value_of("port").unwrap_or("9001").parse::<u16>() {
Ok(n) => n,
-3
View File
@@ -1,4 +1,3 @@
use crate::banner;
use crate::clients::{NymClient, SocketType};
use crate::persistence::pemstore;
@@ -7,8 +6,6 @@ use crypto::identity::{MixnetIdentityKeyPair, MixnetIdentityPublicKey};
use std::net::ToSocketAddrs;
pub fn execute(matches: &ArgMatches) {
println!("{}", banner());
let id = matches.value_of("id").unwrap().to_string();
let port = match matches.value_of("port").unwrap_or("9001").parse::<u16>() {
Ok(n) => n,
+8
View File
@@ -0,0 +1,8 @@
#![recursion_limit = "256"]
pub mod built_info;
pub mod clients;
pub mod commands;
pub mod persistence;
pub mod sockets;
pub mod utils;
+13 -7
View File
@@ -5,15 +5,12 @@ use env_logger;
use log::*;
use std::process;
pub mod built_info;
pub mod clients;
mod commands;
mod persistence;
mod sockets;
pub mod utils;
pub mod built_info {
// The file has been placed there by the build script.
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
fn main() {
env_logger::init();
@@ -94,9 +91,18 @@ fn main() {
fn execute(matches: ArgMatches) -> Result<(), String> {
match matches.subcommand() {
("init", Some(m)) => Ok(commands::init::execute(m)),
("tcpsocket", Some(m)) => Ok(commands::tcpsocket::execute(m)),
("websocket", Some(m)) => Ok(commands::websocket::execute(m)),
("init", Some(m)) => {
println!("{}", banner());
Ok(commands::init::execute(m))
}
("tcpsocket", Some(m)) => {
println!("{}", banner());
Ok(commands::tcpsocket::execute(m))
}
("websocket", Some(m)) => {
println!("{}", banner());
Ok(commands::websocket::execute(m))
}
_ => Err(usage()),
}
}