Monorepo for Tangled
tangled.org
1use crate::host_proxy::VsockTcpProxy;
2use anyhow::Result;
3
4pub struct WriteCacheProxy {
5 inner: VsockTcpProxy,
6}
7
8impl WriteCacheProxy {
9 pub async fn start(host_cid: u32, host_port: u32) -> Result<Option<Self>> {
10 if host_port == 0 {
11 return Ok(None);
12 }
13
14 let inner =
15 VsockTcpProxy::start("write cache proxy", "127.0.0.1:0", host_cid, host_port).await?;
16 Ok(Some(Self { inner }))
17 }
18
19 pub fn url(&self) -> &str {
20 self.inner.url()
21 }
22}