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
package sandbox
import (
"context"
"time"
)
type Program struct {
Source string
Dir string
Timeout time.Duration
Net bool
Env map[string]string
}
type Result struct {
ExitCode int
TimedOut bool
Stdout string
Stderr string
}
type Runner interface {
Run(ctx context.Context, p Program) (Result, error)
Available() bool
Fenced() bool
Kind() string
}
type Fence struct {
Fenced bool
Reason string
Message string
}
type Prober interface {
Probe(ctx context.Context) (Fence, error)
}