summaryrefslogtreecommitdiff
path: root/src/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime.rs')
-rw-r--r--src/runtime.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/runtime.rs b/src/runtime.rs
index 2d5552d..d1b5798 100644
--- a/src/runtime.rs
+++ b/src/runtime.rs
@@ -2,6 +2,18 @@ use crate::model::Trojan;
use anyhow::{Result, bail};
use async_trait::async_trait;
+/// A verified local proxy connection owned by a runtime probe session.
+pub struct ProbeConnection<'a> {
+ pub proxy_url: &'a str,
+ pub certificate: &'a str,
+}
+
+#[async_trait]
+pub trait ProbeSession: Send {
+ fn connection(&self) -> ProbeConnection<'_>;
+ async fn stop(self: Box<Self>);
+}
+
#[async_trait]
pub trait Runtime: Send {
/// Protection must be installed before durable enabled intent changes.
@@ -14,7 +26,7 @@ pub trait Runtime: Send {
async fn maintain(&mut self, connection: Option<&Trojan>, generation: u64) -> Result<()> {
self.apply(connection, generation).await
}
- async fn probe(&mut self, _: &Trojan, _: u64) -> Result<crate::xray::Probe> {
+ async fn probe(&mut self, _: &Trojan, _: u64) -> Result<Box<dyn ProbeSession>> {
bail!("Protected diagnostic probes are unavailable in this runtime")
}
/// Called only after disabled intent has been durably recorded.