1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#[macro_use]
extern crate log;
#[macro_use]
extern crate lazy_static;
pub mod configuration;
pub mod result;
pub mod syscall_filter;
mod util;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "linux")]
pub type SandboxImplementation = linux::LinuxSandbox;
#[cfg(target_os = "macos")]
pub type SandboxImplementation = macos::MacOSSandbox;
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
compile_error!("TAbox not supported on your operating system");
#[cfg(test)]
mod tests;
pub type Result<T> = std::result::Result<T, failure::Error>;
pub trait Sandbox {
fn run(config: configuration::SandboxConfiguration) -> Result<Self>
where
Self: Sized;
fn wait(self) -> Result<result::SandboxExecutionResult>;
fn is_secure() -> bool;
}