refactor
This commit is contained in:
parent
565e400e8d
commit
05bc8cc8fc
2 changed files with 3 additions and 3 deletions
|
|
@ -53,7 +53,7 @@ pub struct EncryptedStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EncryptedStream {
|
impl EncryptedStream {
|
||||||
pub fn bind(address: &str) -> Result<EncryptedStream, Error> {
|
pub fn connect(address: &str) -> Result<EncryptedStream, Error> {
|
||||||
let secret = EphemeralSecret::random();
|
let secret = EphemeralSecret::random();
|
||||||
let public = PublicKey::from(&secret);
|
let public = PublicKey::from(&secret);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use hermes::EncryptedStream;
|
use hermes::EncryptedStream;
|
||||||
use std::env::args;
|
use std::env::args;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::net::{Shutdown, TcpListener};
|
use std::net::{Shutdown, TcpListener, TcpStream};
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
@ -30,7 +30,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"c" => {
|
"c" => {
|
||||||
let mut client = EncryptedStream::bind("127.0.0.1:2007").unwrap();
|
let mut client = EncryptedStream::connect("127.0.0.1:2007").unwrap();
|
||||||
println!("successfully connected client");
|
println!("successfully connected client");
|
||||||
|
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue