aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw-agent
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-12 01:40:46 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-12 01:40:46 -0400
commite45e35125e623a8fb683a28f55ad96d42d01a1d0 (patch)
treeffdf2130cb2197bc3e0769b732dfb4fc933b4618 /src/bin/rbw-agent
parent14b647f9d6dbb76960e6cad6f51531ea6a8dbf3a (diff)
downloadrbw-e45e35125e623a8fb683a28f55ad96d42d01a1d0.tar.gz
rbw-e45e35125e623a8fb683a28f55ad96d42d01a1d0.zip
rename some stuff to be less confusing
Diffstat (limited to 'src/bin/rbw-agent')
-rw-r--r--src/bin/rbw-agent/actions.rs4
-rw-r--r--src/bin/rbw-agent/agent.rs14
-rw-r--r--src/bin/rbw-agent/sock.rs4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/bin/rbw-agent/actions.rs b/src/bin/rbw-agent/actions.rs
index 0eec665..81e2597 100644
--- a/src/bin/rbw-agent/actions.rs
+++ b/src/bin/rbw-agent/actions.rs
@@ -179,7 +179,7 @@ pub async fn decrypt(
}
async fn respond_ack(sock: &mut crate::sock::Sock) -> anyhow::Result<()> {
- sock.send(&rbw::agent::Response::Ack)
+ sock.send(&rbw::protocol::Response::Ack)
.await
.context("failed to send response")?;
@@ -190,7 +190,7 @@ async fn respond_decrypt(
sock: &mut crate::sock::Sock,
plaintext: String,
) -> anyhow::Result<()> {
- sock.send(&rbw::agent::Response::Decrypt { plaintext })
+ sock.send(&rbw::protocol::Response::Decrypt { plaintext })
.await
.context("failed to send response")?;
diff --git a/src/bin/rbw-agent/agent.rs b/src/bin/rbw-agent/agent.rs
index f092787..46af63c 100644
--- a/src/bin/rbw-agent/agent.rs
+++ b/src/bin/rbw-agent/agent.rs
@@ -51,7 +51,7 @@ impl Agent {
= handle_request(&mut sock, state.clone()).await;
if let Err(e) = res {
// unwrap is the only option here
- sock.send(&rbw::agent::Response::Error {
+ sock.send(&rbw::protocol::Response::Error {
error: format!("{:#}", e),
}).await.unwrap();
}
@@ -77,21 +77,21 @@ async fn handle_request(
.await
.context("failed to receive incoming message")?;
match &req.action {
- rbw::agent::Action::Login => {
+ rbw::protocol::Action::Login => {
crate::actions::login(sock, state.clone(), req.tty.as_deref())
.await
}
- rbw::agent::Action::Unlock => {
+ rbw::protocol::Action::Unlock => {
crate::actions::unlock(sock, state.clone(), req.tty.as_deref())
.await
}
- rbw::agent::Action::Lock => {
+ rbw::protocol::Action::Lock => {
crate::actions::lock(sock, state.clone()).await
}
- rbw::agent::Action::Sync => crate::actions::sync(sock).await,
- rbw::agent::Action::Decrypt { cipherstring } => {
+ rbw::protocol::Action::Sync => crate::actions::sync(sock).await,
+ rbw::protocol::Action::Decrypt { cipherstring } => {
crate::actions::decrypt(sock, state.clone(), &cipherstring).await
}
- rbw::agent::Action::Quit => std::process::exit(0),
+ rbw::protocol::Action::Quit => std::process::exit(0),
}
}
diff --git a/src/bin/rbw-agent/sock.rs b/src/bin/rbw-agent/sock.rs
index 6931b13..688f87a 100644
--- a/src/bin/rbw-agent/sock.rs
+++ b/src/bin/rbw-agent/sock.rs
@@ -10,7 +10,7 @@ impl Sock {
pub async fn send(
&mut self,
- res: &rbw::agent::Response,
+ res: &rbw::protocol::Response,
) -> anyhow::Result<()> {
let Self(sock) = self;
sock.write_all(
@@ -26,7 +26,7 @@ impl Sock {
Ok(())
}
- pub async fn recv(&mut self) -> anyhow::Result<rbw::agent::Request> {
+ pub async fn recv(&mut self) -> anyhow::Result<rbw::protocol::Request> {
let Self(sock) = self;
let mut buf = tokio::io::BufStream::new(sock);
let mut line = String::new();