[][src]Struct jail::StoppedJail

pub struct StoppedJail {
    pub path: Option<PathBuf>,
    pub name: Option<String>,
    pub hostname: Option<String>,
    pub params: HashMap<String, Value>,
    pub ips: Vec<IpAddr>,
    pub limits: Vec<(Resource, Limit, Action)>,
}

Represent a stopped jail including all information required to start it

Fields

path: Option<PathBuf>

The path of root file system of the jail

name: Option<String>

The jail name

hostname: Option<String>

The jail hostname

params: HashMap<String, Value>

A hashmap of jail parameters and their values

ips: Vec<IpAddr>

A list of IP (v4 and v6) addresses to be assigned to this jail

limits: Vec<(Resource, Limit, Action)>

A list of resource limits

Implementations

impl StoppedJail[src]

pub fn new<P: Into<PathBuf> + Debug>(path: P) -> StoppedJail[src]

Create a new Jail instance given a path.

Examples

use jail::StoppedJail;

let j = StoppedJail::new("/rescue");

pub fn start(self: StoppedJail) -> Result<RunningJail, JailError>[src]

Start the jail

This will call jail_create internally. This will consume the StoppedJail and return a Result<RunningJail,Error>.

Examples

use jail::StoppedJail;

let stopped = StoppedJail::new("/rescue");
let running = stopped.start().unwrap();

pub fn name<S: Into<String> + Debug>(self, name: S) -> Self[src]

Set the jail name

Examples

let mut stopped = StoppedJail::new("/rescue")
    .name("test_stopped_name");

assert_eq!(stopped.name, Some("test_stopped_name".to_string()));

pub fn hostname<S: Into<String> + Debug>(self, hostname: S) -> Self[src]

Set the jail name

Examples

let mut stopped = StoppedJail::new("/rescue")
    .hostname("example.com");

assert_eq!(stopped.hostname, Some("example.com".to_string()));

pub fn param<S: Into<String> + Debug>(self, param: S, value: Value) -> Self[src]

Set a jail parameter

Examples

use jail::param;

let mut stopped = StoppedJail::new("/rescue")
    .param("allow.raw_sockets", param::Value::Int(1));

pub fn limit(self, resource: Resource, limit: Limit, action: Action) -> Self[src]

Set a resource limit

Examples

extern crate rctl;
use rctl;
let mut stopped = StoppedJail::new("/rescue").limit(
    rctl::Resource::MemoryUse,
    rctl::Limit::amount_per(100 * 1024 * 1024, rctl::SubjectType::Process),
    rctl::Action::Deny,
);

pub fn ip(self, ip: IpAddr) -> Self[src]

Add an IP Address

Examples

let mut stopped = StoppedJail::new("rescue")
    .ip("127.0.1.1".parse().expect("could not parse 127.0.1.1"))
    .ip("fe80::2".parse().expect("could not parse ::1"));

Trait Implementations

impl Clone for StoppedJail[src]

impl Debug for StoppedJail[src]

impl Default for StoppedJail[src]

impl Eq for StoppedJail[src]

impl From<StoppedJail> for Jail[src]

impl PartialEq<StoppedJail> for StoppedJail[src]

impl StructuralEq for StoppedJail[src]

impl StructuralPartialEq for StoppedJail[src]

impl TryFrom<RunningJail> for StoppedJail[src]

type Error = JailError

The type returned in the event of a conversion error.

impl TryFrom<StoppedJail> for RunningJail[src]

type Error = JailError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for StoppedJail

impl Send for StoppedJail

impl Sync for StoppedJail

impl Unpin for StoppedJail

impl UnwindSafe for StoppedJail

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.