1 #![feature(macro_rules)]
4 extern crate serialize
;
9 use end_point
::{ Client
, Server
};
15 const PORT
: u16 = 4221;
18 println!("{} <genkey> | <tests> | ...", os
::args()[0]);
22 let args
= os
::args();
24 if args
.iter().any(|a
| a
.as_slice() == "--help" || a
.as_slice() == "-h") {
26 } else if args
.len() > 1 && args
[1].as_slice() == "genkey" {
27 match crypto
::generate_key(256 / 8) {
28 Ok(key
) => println!("key: {}", key
),
29 Err(e
) => println!("Unable to generate a key. Error: {}", e
)
32 println!("Starting server...");
34 match Server
::new("::1", PORT
) {
36 println!("Server started");
38 Client
::start_tests("::1", PORT
);
40 println!("Press any key to quit");
41 io
::stdin().read_line().ok().expect("Failed to read line");
43 server
.close().ok().expect("Failed to close the server");
46 println!("Unable to create a new server. Error: {}", e
)