Add a separate client binary, with some common code to the server.

The cargo workspace thing was a PITA to figure out, but it seems to be working.  Could maybe be simplified?
This commit is contained in:
Barry Pederson
2024-11-02 15:58:35 -07:00
parent 46ad77f19e
commit 076e48f457
16 changed files with 380 additions and 255 deletions
+23
View File
@@ -0,0 +1,23 @@
mod options;
use crate::options::OPTIONS;
use common::{read_string, Request};
use std::os::unix::net::UnixStream;
fn main() -> std::io::Result<()> {
let mut stream = UnixStream::connect(&OPTIONS.socket_name)?;
println!("Connected to server");
let request = Request {
userid: OPTIONS.username.clone(),
password: OPTIONS.password.clone(),
service: "ignore-this".to_string(),
realm: "also-ignore-this".to_string(),
};
request.write_to_stream(&mut stream)?;
let response = read_string(&mut stream)?;
println!("Response: {}", response);
Ok(())
}