feat(#14): network isolation rust side — PRIVATE_NETWORK + veth wiring in set_nspawn_flags

This commit is contained in:
damocles 2026-05-31 21:06:07 +02:00 committed by mara
commit 3bb07b1fde
4 changed files with 185 additions and 24 deletions

View file

@ -7,7 +7,9 @@
//! a persistent connection.
use anyhow::{Context as _, Result, bail};
use hive_sh4re::priv_proto::{BindMount, JournalOutput, PRIV_SOCK, PrivRequest, PrivResponse};
use hive_sh4re::priv_proto::{
BindMount, JournalOutput, NetworkIsolation, PRIV_SOCK, PrivRequest, PrivResponse,
};
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::UnixStream;
@ -112,10 +114,15 @@ pub async fn read_container_journal(
)
}
pub async fn write_nspawn_flags(container: &str, binds: &[BindMount]) -> Result<()> {
pub async fn write_nspawn_flags(
container: &str,
binds: &[BindMount],
isolation: Option<NetworkIsolation>,
) -> Result<()> {
ok(call(&PrivRequest::WriteNspawnFlags {
container: container.to_owned(),
binds: binds.to_vec(),
isolation,
})
.await?)
}