5f2fdf93df305e1e64b90692ee699c8ce30cf831
1 #![feature(macro_rules)]
4 extern crate serialize
;
9 use end_point
::{ Client
, Server
};
17 * Comment stocker les clefs? à quels critères doivent elle répondre?
21 const PORT
: u16 = 4221;
24 println!("{} <genkey> | <tests> | ...", os
::args()[0]);
28 let args
= os
::args();
30 if args
.iter().any(|a
| a
.as_slice() == "--help" || a
.as_slice() == "-h") {
32 } else if args
.len() > 1 && args
[1].as_slice() == "genkey" {
33 match crypto
::generate_key(256 / 8) {
34 Ok(key
) => println!("key: {}", key
),
35 Err(e
) => println!("Unable to generate a key. Error: {}", e
)
38 println!("Starting server..., Press any key to quit");
40 match Server
::new("::1", PORT
) {
42 println!("Server started");
43 Client
::start_tests("::1", PORT
);
44 io
::stdin().read_line().ok().expect("Failed to read line");
45 server
.close().ok().expect("Failed to close the server");
48 println!("Unable to create a new server. Error: {}", e
)