summaryrefslogtreecommitdiffstats
path: root/src/sandbox/wire.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sandbox/wire.rs')
-rw-r--r--src/sandbox/wire.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sandbox/wire.rs b/src/sandbox/wire.rs
index a0d06ca..ae89d6d 100644
--- a/src/sandbox/wire.rs
+++ b/src/sandbox/wire.rs
@@ -2,11 +2,11 @@ use std::io::{self, BufRead, Write};
use serde::{Deserialize, Serialize};
-pub const MAX_FRAME_BYTES: u32 = 2 * 1024 * 1024 * 1024;
+pub(crate) const MAX_FRAME_BYTES: u32 = 2 * 1024 * 1024 * 1024;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "t", rename_all = "snake_case")]
-pub enum Frame {
+pub(crate) enum Frame {
/// agent → hub, first frame on every connection: the outbound rendezvous.
Hello { token: String, agent_id: String, profiles: Vec<String> },
/// hub → agent: rendezvous accepted; `ttl_secs` arms the agent's watchdog.
@@ -35,7 +35,7 @@ pub enum Frame {
Destroy {},
}
-pub fn write_frame(w: &mut impl Write, f: &Frame) -> io::Result<()> {
+pub(crate) fn write_frame(w: &mut impl Write, f: &Frame) -> io::Result<()> {
let body = serde_json::to_vec(f)
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
if body.len() as u64 > MAX_FRAME_BYTES as u64 {
@@ -46,7 +46,7 @@ pub fn write_frame(w: &mut impl Write, f: &Frame) -> io::Result<()> {
w.flush()
}
-pub fn read_frame(r: &mut impl BufRead) -> io::Result<Option<Frame>> {
+pub(crate) fn read_frame(r: &mut impl BufRead) -> io::Result<Option<Frame>> {
let mut len = [0u8; 4];
match r.read_exact(&mut len) {
Ok(()) => {}
@@ -64,11 +64,11 @@ pub fn read_frame(r: &mut impl BufRead) -> io::Result<Option<Frame>> {
Ok(Some(f))
}
-pub fn hex_bytes(b: &[u8]) -> String {
+pub(crate) fn hex_bytes(b: &[u8]) -> String {
hex::encode(b)
}
-pub fn unhex(s: &str) -> io::Result<Vec<u8>> {
+pub(crate) fn unhex(s: &str) -> io::Result<Vec<u8>> {
hex::decode(s).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
}